2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-23 02:28:55 +00:00
bind/win32utils/libuv.diff
Witold Kręcicki c6c0a9fdba Add isc_uv_export()/isc_uv_import() functions to libuv compatibility layer.
These functions can be used to pass a uv handle between threads in a
safe manner. The other option is to use uv_pipe and pass the uv_handle
via IPC, which is way more complex.  uv_export() and uv_import() functions
existed in libuv at some point but were removed later. This code is
based on the original removed code.

The Windows version of the code uses two functions internal to libuv;
a patch for libuv is attached for exporting these functions.
2020-01-13 10:52:07 -08:00

28 lines
1.2 KiB
Diff

To make TCP listening properly multithreaded, we need to have the
uv_export() and uv_import() functions that were removed from libuv.
The alternative is passing sockets over IPC, which is complicated and
error prone.
To make it simple, we export two internal functions from libuv; they will
be used in lib/isc/netmgr/uv-compat.c by our versions of the uv_export()
and uv_import() functions.
diff --git a/src/win/internal.h b/src/win/internal.h
index 058ddb8e..a9dc4168 100644
--- a/src/win/internal.h
+++ b/src/win/internal.h
@@ -92,11 +92,11 @@ void uv_process_tcp_connect_req(uv_loop_t* loop, uv_tcp_t* handle,
void uv_tcp_close(uv_loop_t* loop, uv_tcp_t* tcp);
void uv_tcp_endgame(uv_loop_t* loop, uv_tcp_t* handle);
-int uv__tcp_xfer_export(uv_tcp_t* handle,
+UV_EXTERN int uv__tcp_xfer_export(uv_tcp_t* handle,
int pid,
uv__ipc_socket_xfer_type_t* xfer_type,
uv__ipc_socket_xfer_info_t* xfer_info);
-int uv__tcp_xfer_import(uv_tcp_t* tcp,
+UV_EXTERN int uv__tcp_xfer_import(uv_tcp_t* tcp,
uv__ipc_socket_xfer_type_t xfer_type,
uv__ipc_socket_xfer_info_t* xfer_info);