Skip to content

Commit

Permalink
[test][zts] fix tests [5]
Browse files Browse the repository at this point in the history
  • Loading branch information
matyhtf committed Aug 15, 2024
1 parent c540d67 commit 9734deb
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 9 deletions.
1 change: 1 addition & 0 deletions .github/workflows/iouring.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on: [push, pull_request]
jobs:
test-linux:
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, '[test]')"
strategy:
fail-fast: false
matrix:
Expand Down
8 changes: 8 additions & 0 deletions include/swoole_socket.h
Original file line number Diff line number Diff line change
Expand Up @@ -492,6 +492,14 @@ struct Socket {
return ::read(fd, __buf, __len);
}

ssize_t read_sync(void *__buf, size_t __len, int timeout_ms = -1) {
if (wait_event(timeout_ms, SW_EVENT_READ) == SW_OK) {
return read(__buf, __len);
} else {
return -1;
}
}

int shutdown(int __how) {
return ::shutdown(fd, __how);
}
Expand Down
9 changes: 1 addition & 8 deletions src/os/process_pool.cc
Original file line number Diff line number Diff line change
Expand Up @@ -544,10 +544,6 @@ static int ProcessPool_worker_loop_with_task_protocol(ProcessPool *pool, Worker
out.mtype = worker->id + 1;
}

if (worker->pipe_worker) {
worker->pipe_worker->set_block();
}

while (pool->running && !SwooleWG.shutdown && task_n > 0) {
/**
* fetch task
Expand Down Expand Up @@ -575,10 +571,7 @@ static int ProcessPool_worker_loop_with_task_protocol(ProcessPool *pool, Worker
}
pool->stream_info_->last_connection = conn;
} else {
n = worker->pipe_worker->read(&out.buf, sizeof(out.buf));
if (n < 0 && errno != EINTR) {
swoole_sys_warning("read(%d) failed", worker->pipe_worker->fd);
}
n = worker->pipe_worker->read_sync(&out.buf, sizeof(out.buf));
}

/**
Expand Down
2 changes: 1 addition & 1 deletion tests/include/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ function get_one_free_port(): int

function get_constant_port(string $str, int $base = 9500): int
{
return $base + crc32(__FILE__) % 1000;
return $base + crc32(__FILE__) % 10000;
}

function get_one_free_port_ipv6(): int
Expand Down

0 comments on commit 9734deb

Please sign in to comment.