Compare commits

...

1 Commits

Author SHA1 Message Date
U-DESKTOP-5UMITBO\wpk
fd815672cb xxx 2020-01-15 12:16:03 +01:00
3 changed files with 47 additions and 13 deletions

View File

@@ -245,10 +245,11 @@ typedef isc__netievent_t isc__netievent_shutdown_t;
typedef isc__netievent_t isc__netievent_stop_t; typedef isc__netievent_t isc__netievent_stop_t;
typedef union { typedef union {
isc__netievent_t ni; isc__netievent_t ni;
isc__netievent__socket_t nis; isc__netievent__socket_t nis;
isc__netievent__socket_req_t nisr; isc__netievent__socket_req_t nisr;
isc__netievent_udpsend_t nius; isc__netievent_udpsend_t nius;
isc__netievent__socket_streaminfo_t niss;
} isc__netievent_storage_t; } isc__netievent_storage_t;
/* /*

View File

@@ -295,7 +295,8 @@ isc__nm_async_tcplisten(isc__networker_t *worker, isc__netievent_t *ev0) {
event = isc__nm_get_ievent(csock->mgr, event = isc__nm_get_ievent(csock->mgr,
netievent_tcpchildlisten); netievent_tcpchildlisten);
isc_uv_export(&sock->uv_handle.stream, &event->streaminfo); int r = isc_uv_export(&sock->uv_handle.stream, &event->streaminfo);
RUNTIME_CHECK(r == 0);
event->sock = csock; event->sock = csock;
if (csock->tid == isc_nm_tid()) { if (csock->tid == isc_nm_tid()) {
isc__nm_async_tcpchildlisten(&sock->mgr->workers[i], isc__nm_async_tcpchildlisten(&sock->mgr->workers[i],
@@ -334,11 +335,17 @@ isc__nm_async_tcpchildlisten(isc__networker_t *worker, isc__netievent_t *ev0) {
uv_tcp_init(&worker->loop, (uv_tcp_t *) &sock->uv_handle.tcp); uv_tcp_init(&worker->loop, (uv_tcp_t *) &sock->uv_handle.tcp);
uv_handle_set_data(&sock->uv_handle.handle, sock); uv_handle_set_data(&sock->uv_handle.handle, sock);
isc_uv_import(&sock->uv_handle.stream, &ievent->streaminfo); r = isc_uv_import(&sock->uv_handle.stream, &ievent->streaminfo);
if (r != 0) {
isc_log_write(isc_lctx, ISC_LOGCATEGORY_GENERAL,
ISC_LOGMODULE_NETMGR, ISC_LOG_ERROR,
"uv_import failed: %s",
isc_result_totext(isc__nm_uverr2result(r)));
return;
}
r = uv_listen((uv_stream_t *) &sock->uv_handle.tcp, sock->backlog, r = uv_listen((uv_stream_t *) &sock->uv_handle.tcp, sock->backlog,
tcp_connection_cb); tcp_connection_cb);
if (r != 0) { if (r != 0) {
isc_log_write(isc_lctx, ISC_LOGCATEGORY_GENERAL, isc_log_write(isc_lctx, ISC_LOGCATEGORY_GENERAL,
ISC_LOGMODULE_NETMGR, ISC_LOG_ERROR, ISC_LOGMODULE_NETMGR, ISC_LOG_ERROR,
@@ -768,6 +775,9 @@ tcp_connection_cb(uv_stream_t *server, int status) {
isc_result_t result; isc_result_t result;
UNUSED(status); UNUSED(status);
isc_log_write(isc_lctx, ISC_LOGCATEGORY_GENERAL,
ISC_LOGMODULE_NETMGR, ISC_LOG_ERROR,
"TCP connection cb");
result = accept_connection(ssock); result = accept_connection(ssock);
if (result != ISC_R_SUCCESS) { if (result != ISC_R_SUCCESS) {

View File

@@ -10,6 +10,7 @@
*/ */
#include <unistd.h> #include <unistd.h>
#include <isc/log.h>
#include "uv-compat.h" #include "uv-compat.h"
/* /*
@@ -35,21 +36,42 @@ typedef struct {
int int
uv__tcp_xfer_import(uv_tcp_t *tcp, uv__ipc_socket_xfer_type_t xfer_type, uv__tcp_xfer_import(uv_tcp_t *tcp, uv__ipc_socket_xfer_type_t xfer_type,
uv__ipc_socket_xfer_info_t *xfer_info); uv__ipc_socket_xfer_info_t *xfer_info);
int int
uv__tcp_xfer_export(uv_tcp_t *handle, int pid, uv__tcp_xfer_export(uv_tcp_t* handle,
uv__ipc_socket_xfer_info_t *xfer_info); int target_pid,
uv__ipc_socket_xfer_type_t* xfer_type,
uv__ipc_socket_xfer_info_t* xfer_info);
int int
isc_uv_export(uv_stream_t *stream, isc_uv_stream_info_t *info) { isc_uv_export(uv_stream_t *stream, isc_uv_stream_info_t *info) {
uv__ipc_socket_xfer_info_t xfer_info;
uv__ipc_socket_xfer_type_t xfer_type;
isc_log_write(isc_lctx, ISC_LOGCATEGORY_GENERAL,
ISC_LOGMODULE_NETMGR, ISC_LOG_ERROR,
"uv_export sizeofs 1 %d 2 %d", sizeof(isc_uv_stream_info_t), sizeof(uv__ipc_socket_xfer_info_t));
if (stream->type != UV_TCP) { if (stream->type != UV_TCP) {
isc_log_write(isc_lctx, ISC_LOGCATEGORY_GENERAL,
ISC_LOGMODULE_NETMGR, ISC_LOG_ERROR,
"uv_export failed: stream not tcp");
return (-1); return (-1);
} }
if (uv__tcp_xfer_export((uv_tcp_t *) stream, GetCurrentProcessId(), int r = uv__tcp_xfer_export((uv_tcp_t *) stream, GetCurrentProcessId(), &xfer_type, &xfer_info);
&info->socket_info) == -1) { if (r != 0) {
return (-1); isc_log_write(isc_lctx, ISC_LOGCATEGORY_GENERAL,
ISC_LOGMODULE_NETMGR, ISC_LOG_ERROR,
"uv_export failed: result %d", r);
return (r);
}
if (xfer_info.delayed_error != 0) {
isc_log_write(isc_lctx, ISC_LOGCATEGORY_GENERAL,
ISC_LOGMODULE_NETMGR, ISC_LOG_ERROR,
"uv_export failed: delayed error %d", xfer_info.delayed_error);
return (xfer_info.delayed_error);
} }
info->type = UV_TCP; info->type = UV_TCP;
info->socket_info = xfer_info.socket_info;
return (0);
} }
int int
@@ -59,6 +81,7 @@ isc_uv_import(uv_stream_t *stream, isc_uv_stream_info_t *info) {
if (stream->type != UV_TCP || info->type != UV_TCP) { if (stream->type != UV_TCP || info->type != UV_TCP) {
return (-1); return (-1);
} }
xfer_info.delayed_error = 0;
xfer_info.socket_info = info->socket_info; xfer_info.socket_info = info->socket_info;
return (uv__tcp_xfer_import((uv_tcp_t *) stream, return (uv__tcp_xfer_import((uv_tcp_t *) stream,