diff --git a/lib/isc/unix/socket.c b/lib/isc/unix/socket.c index ee0f2f2596..ff1f147871 100644 --- a/lib/isc/unix/socket.c +++ b/lib/isc/unix/socket.c @@ -3072,7 +3072,6 @@ finish: unwatch_fd(&sock->manager->threads[sock->threadid], sock->fd, SELECT_POKE_READ); } - UNLOCK(&sock->lock); } static void @@ -3112,7 +3111,6 @@ finish: unwatch_fd(&sock->manager->threads[sock->threadid], sock->fd, SELECT_POKE_WRITE); } - UNLOCK(&sock->lock); } /* @@ -3158,14 +3156,6 @@ process_fd(isc__socketthread_t *thread, int fd, bool readable, bool writeable) { } REQUIRE(readable || writeable); - if (readable) { - if (sock->listener) { - internal_accept(sock); - } else { - internal_recv(sock); - } - } - if (writeable) { if (sock->connecting) { internal_connect(sock); @@ -3174,7 +3164,17 @@ process_fd(isc__socketthread_t *thread, int fd, bool readable, bool writeable) { } } - /* sock->lock is unlocked in internal_* function */ + if (readable) { + if (sock->listener) { + internal_accept(sock); /* unlocks sock */ + } else { + internal_recv(sock); + UNLOCK(&sock->lock); + } + } else { + UNLOCK(&sock->lock); + } + UNLOCK(&thread->fdlock[lockid]); /* @@ -4950,7 +4950,6 @@ internal_connect(isc__socket_t *sock) { finish: unwatch_fd(&sock->manager->threads[sock->threadid], sock->fd, SELECT_POKE_CONNECT); - UNLOCK(&sock->lock); } isc_result_t