mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-31 06:25:31 +00:00
Use isc_uv_export() to pass bound TCP listening socket to child listeners.
For multithreaded TCP listening we need to pass a bound socket to all listening threads. Instead of using uv_pipe handle passing method which is quite complex (lots of callbacks, each of them with its own error handling) we now use isc_uv_export() to export the socket, pass it as a member of the isc__netievent_tcpchildlisten_t structure, and then isc_uv_import() it in the child thread, simplifying the process significantly.
This commit is contained in:
committed by
Evan Hunt
parent
c6c0a9fdba
commit
67c1ca9a79
@@ -43,12 +43,6 @@
|
||||
|
||||
ISC_THREAD_LOCAL int isc__nm_tid_v = ISC_NETMGR_TID_UNKNOWN;
|
||||
|
||||
#ifdef WIN32
|
||||
#define NAMED_PIPE_PATTERN "\\\\.\\pipe\\named-%d-%u.pipe"
|
||||
#else
|
||||
#define NAMED_PIPE_PATTERN "/tmp/named-%d-%u.pipe"
|
||||
#endif
|
||||
|
||||
static void
|
||||
nmsocket_maybe_destroy(isc_nmsocket_t *sock);
|
||||
static void
|
||||
@@ -856,16 +850,6 @@ isc__nmsocket_init(isc_nmsocket_t *sock, isc_nm_t *mgr,
|
||||
sock->ah_handles[i] = NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* Use a random number in the named pipe name. Also add getpid()
|
||||
* to the name to make sure we don't get a conflict between
|
||||
* different unit tests running at the same time, where the PRNG
|
||||
* is initialized to a constant seed.
|
||||
*/
|
||||
snprintf(sock->ipc_pipe_name, sizeof(sock->ipc_pipe_name),
|
||||
NAMED_PIPE_PATTERN, getpid(), isc_random32());
|
||||
sock->ipc_pipe_name[sizeof(sock->ipc_pipe_name) - 1] = '\0';
|
||||
|
||||
isc_mutex_init(&sock->lock);
|
||||
isc_condition_init(&sock->cond);
|
||||
isc_refcount_init(&sock->references, 1);
|
||||
|
Reference in New Issue
Block a user