Skip to content

Commit 33535b6

Browse files
committed
1 parent ec5d168 commit 33535b6

File tree

2 files changed

+2
-6
lines changed

2 files changed

+2
-6
lines changed

include/swoole.h

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1820,11 +1820,7 @@ void swReactor_defer_task_destroy(swReactor *reactor);
18201820

18211821
static sw_inline swConnection* swReactor_get(swReactor *reactor, int fd)
18221822
{
1823-
if (reactor->thread)
1824-
{
1825-
return &reactor->socket_list[fd];
1826-
}
1827-
swConnection *socket = (swConnection*) swArray_alloc(reactor->socket_array, fd);
1823+
swConnection *socket = reactor->thread ? &reactor->socket_list[fd] : (swConnection*) swArray_alloc(reactor->socket_array, fd);
18281824
if (socket && !socket->active)
18291825
{
18301826
socket->fd = fd;

src/reactor/base.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ int swReactor_write(swReactor *reactor, int fd, void *buf, int n)
231231
swConnection *socket = swReactor_get(reactor, fd);
232232
swBuffer *buffer = socket->out_buffer;
233233

234-
if (socket->fd == 0)
234+
if (socket->fd <= 0)
235235
{
236236
socket->fd = fd;
237237
}

0 commit comments

Comments
 (0)