mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-09-03 16:15:27 +00:00
associate socket stats counters with netmgr socket objects
- the socket stat counters have been moved from socket.h to stats.h. - isc_nm_t now attaches to the same stats counter group as isc_socketmgr_t, so that both managers can increment the same set of statistics - isc__nmsocket_init() now takes an interface as a paramter so that the address family can be determined when initializing the socket. - based on the address family and socket type, a group of statistics counters will be associated with the socket - for example, UDP4Active with IPv4 UDP sockets and TCP6Active with IPv6 TCP sockets. note that no counters are currently associated with TCPDNS sockets; those stats will be handled by the underlying TCP socket. - the counters are not actually used by netmgr sockets yet; counter increment and decrement calls will be added in a later commit.
This commit is contained in:
@@ -9941,6 +9941,7 @@ named_server_create(isc_mem_t *mctx, named_server_t **serverp) {
|
||||
isc_sockstatscounter_max),
|
||||
"isc_stats_create");
|
||||
isc_socketmgr_setstats(named_g_socketmgr, server->sockstats);
|
||||
isc_nm_setstats(named_g_nm, server->sockstats);
|
||||
|
||||
CHECKFATAL(isc_stats_create(named_g_mctx, &server->zonestats,
|
||||
dns_zonestatscounter_max),
|
||||
|
@@ -357,3 +357,15 @@ isc_nm_maxudp(isc_nm_t *mgr, uint32_t maxudp);
|
||||
* Simulate a broken firewall that blocks UDP messages larger than a given
|
||||
* size.
|
||||
*/
|
||||
|
||||
void
|
||||
isc_nm_setstats(isc_nm_t *mgr, isc_stats_t *stats);
|
||||
/*%<
|
||||
* Set a socket statistics counter set 'stats' for 'mgr'.
|
||||
*
|
||||
* Requires:
|
||||
*\li 'mgr' is valid and doesn't have stats already set.
|
||||
*
|
||||
*\li stats is a valid set of statistics counters supporting the
|
||||
* full range of socket-related stats counter numbers.
|
||||
*/
|
||||
|
@@ -85,87 +85,6 @@ typedef enum {
|
||||
} isc_socket_options_t;
|
||||
/*@}*/
|
||||
|
||||
/*%
|
||||
* Statistics counters. Used as isc_statscounter_t values.
|
||||
*/
|
||||
enum {
|
||||
isc_sockstatscounter_udp4open = 0,
|
||||
isc_sockstatscounter_udp6open = 1,
|
||||
isc_sockstatscounter_tcp4open = 2,
|
||||
isc_sockstatscounter_tcp6open = 3,
|
||||
isc_sockstatscounter_unixopen = 4,
|
||||
|
||||
isc_sockstatscounter_udp4openfail = 5,
|
||||
isc_sockstatscounter_udp6openfail = 6,
|
||||
isc_sockstatscounter_tcp4openfail = 7,
|
||||
isc_sockstatscounter_tcp6openfail = 8,
|
||||
isc_sockstatscounter_unixopenfail = 9,
|
||||
|
||||
isc_sockstatscounter_udp4close = 10,
|
||||
isc_sockstatscounter_udp6close = 11,
|
||||
isc_sockstatscounter_tcp4close = 12,
|
||||
isc_sockstatscounter_tcp6close = 13,
|
||||
isc_sockstatscounter_unixclose = 14,
|
||||
isc_sockstatscounter_fdwatchclose = 15,
|
||||
|
||||
isc_sockstatscounter_udp4bindfail = 16,
|
||||
isc_sockstatscounter_udp6bindfail = 17,
|
||||
isc_sockstatscounter_tcp4bindfail = 18,
|
||||
isc_sockstatscounter_tcp6bindfail = 19,
|
||||
isc_sockstatscounter_unixbindfail = 20,
|
||||
isc_sockstatscounter_fdwatchbindfail = 21,
|
||||
|
||||
isc_sockstatscounter_udp4connect = 22,
|
||||
isc_sockstatscounter_udp6connect = 23,
|
||||
isc_sockstatscounter_tcp4connect = 24,
|
||||
isc_sockstatscounter_tcp6connect = 25,
|
||||
isc_sockstatscounter_unixconnect = 26,
|
||||
isc_sockstatscounter_fdwatchconnect = 27,
|
||||
|
||||
isc_sockstatscounter_udp4connectfail = 28,
|
||||
isc_sockstatscounter_udp6connectfail = 29,
|
||||
isc_sockstatscounter_tcp4connectfail = 30,
|
||||
isc_sockstatscounter_tcp6connectfail = 31,
|
||||
isc_sockstatscounter_unixconnectfail = 32,
|
||||
isc_sockstatscounter_fdwatchconnectfail = 33,
|
||||
|
||||
isc_sockstatscounter_tcp4accept = 34,
|
||||
isc_sockstatscounter_tcp6accept = 35,
|
||||
isc_sockstatscounter_unixaccept = 36,
|
||||
|
||||
isc_sockstatscounter_tcp4acceptfail = 37,
|
||||
isc_sockstatscounter_tcp6acceptfail = 38,
|
||||
isc_sockstatscounter_unixacceptfail = 39,
|
||||
|
||||
isc_sockstatscounter_udp4sendfail = 40,
|
||||
isc_sockstatscounter_udp6sendfail = 41,
|
||||
isc_sockstatscounter_tcp4sendfail = 42,
|
||||
isc_sockstatscounter_tcp6sendfail = 43,
|
||||
isc_sockstatscounter_unixsendfail = 44,
|
||||
isc_sockstatscounter_fdwatchsendfail = 45,
|
||||
|
||||
isc_sockstatscounter_udp4recvfail = 46,
|
||||
isc_sockstatscounter_udp6recvfail = 47,
|
||||
isc_sockstatscounter_tcp4recvfail = 48,
|
||||
isc_sockstatscounter_tcp6recvfail = 49,
|
||||
isc_sockstatscounter_unixrecvfail = 50,
|
||||
isc_sockstatscounter_fdwatchrecvfail = 51,
|
||||
|
||||
isc_sockstatscounter_udp4active = 52,
|
||||
isc_sockstatscounter_udp6active = 53,
|
||||
isc_sockstatscounter_tcp4active = 54,
|
||||
isc_sockstatscounter_tcp6active = 55,
|
||||
isc_sockstatscounter_unixactive = 56,
|
||||
|
||||
isc_sockstatscounter_rawopen = 57,
|
||||
isc_sockstatscounter_rawopenfail = 58,
|
||||
isc_sockstatscounter_rawclose = 59,
|
||||
isc_sockstatscounter_rawrecvfail = 60,
|
||||
isc_sockstatscounter_rawactive = 61,
|
||||
|
||||
isc_sockstatscounter_max = 62
|
||||
};
|
||||
|
||||
/*@{*/
|
||||
/*!
|
||||
* _ATTACHED: Internal use only.
|
||||
|
@@ -19,6 +19,90 @@
|
||||
|
||||
#include <isc/types.h>
|
||||
|
||||
/*%
|
||||
* Statistics counters. Used as isc_statscounter_t values.
|
||||
*/
|
||||
enum {
|
||||
/*%
|
||||
* Socket statistics counters.
|
||||
*/
|
||||
isc_sockstatscounter_udp4open = 0,
|
||||
isc_sockstatscounter_udp6open = 1,
|
||||
isc_sockstatscounter_tcp4open = 2,
|
||||
isc_sockstatscounter_tcp6open = 3,
|
||||
isc_sockstatscounter_unixopen = 4,
|
||||
|
||||
isc_sockstatscounter_udp4openfail = 5,
|
||||
isc_sockstatscounter_udp6openfail = 6,
|
||||
isc_sockstatscounter_tcp4openfail = 7,
|
||||
isc_sockstatscounter_tcp6openfail = 8,
|
||||
isc_sockstatscounter_unixopenfail = 9,
|
||||
|
||||
isc_sockstatscounter_udp4close = 10,
|
||||
isc_sockstatscounter_udp6close = 11,
|
||||
isc_sockstatscounter_tcp4close = 12,
|
||||
isc_sockstatscounter_tcp6close = 13,
|
||||
isc_sockstatscounter_unixclose = 14,
|
||||
isc_sockstatscounter_fdwatchclose = 15,
|
||||
|
||||
isc_sockstatscounter_udp4bindfail = 16,
|
||||
isc_sockstatscounter_udp6bindfail = 17,
|
||||
isc_sockstatscounter_tcp4bindfail = 18,
|
||||
isc_sockstatscounter_tcp6bindfail = 19,
|
||||
isc_sockstatscounter_unixbindfail = 20,
|
||||
isc_sockstatscounter_fdwatchbindfail = 21,
|
||||
|
||||
isc_sockstatscounter_udp4connect = 22,
|
||||
isc_sockstatscounter_udp6connect = 23,
|
||||
isc_sockstatscounter_tcp4connect = 24,
|
||||
isc_sockstatscounter_tcp6connect = 25,
|
||||
isc_sockstatscounter_unixconnect = 26,
|
||||
isc_sockstatscounter_fdwatchconnect = 27,
|
||||
|
||||
isc_sockstatscounter_udp4connectfail = 28,
|
||||
isc_sockstatscounter_udp6connectfail = 29,
|
||||
isc_sockstatscounter_tcp4connectfail = 30,
|
||||
isc_sockstatscounter_tcp6connectfail = 31,
|
||||
isc_sockstatscounter_unixconnectfail = 32,
|
||||
isc_sockstatscounter_fdwatchconnectfail = 33,
|
||||
|
||||
isc_sockstatscounter_tcp4accept = 34,
|
||||
isc_sockstatscounter_tcp6accept = 35,
|
||||
isc_sockstatscounter_unixaccept = 36,
|
||||
|
||||
isc_sockstatscounter_tcp4acceptfail = 37,
|
||||
isc_sockstatscounter_tcp6acceptfail = 38,
|
||||
isc_sockstatscounter_unixacceptfail = 39,
|
||||
|
||||
isc_sockstatscounter_udp4sendfail = 40,
|
||||
isc_sockstatscounter_udp6sendfail = 41,
|
||||
isc_sockstatscounter_tcp4sendfail = 42,
|
||||
isc_sockstatscounter_tcp6sendfail = 43,
|
||||
isc_sockstatscounter_unixsendfail = 44,
|
||||
isc_sockstatscounter_fdwatchsendfail = 45,
|
||||
|
||||
isc_sockstatscounter_udp4recvfail = 46,
|
||||
isc_sockstatscounter_udp6recvfail = 47,
|
||||
isc_sockstatscounter_tcp4recvfail = 48,
|
||||
isc_sockstatscounter_tcp6recvfail = 49,
|
||||
isc_sockstatscounter_unixrecvfail = 50,
|
||||
isc_sockstatscounter_fdwatchrecvfail = 51,
|
||||
|
||||
isc_sockstatscounter_udp4active = 52,
|
||||
isc_sockstatscounter_udp6active = 53,
|
||||
isc_sockstatscounter_tcp4active = 54,
|
||||
isc_sockstatscounter_tcp6active = 55,
|
||||
isc_sockstatscounter_unixactive = 56,
|
||||
|
||||
isc_sockstatscounter_rawopen = 57,
|
||||
isc_sockstatscounter_rawopenfail = 58,
|
||||
isc_sockstatscounter_rawclose = 59,
|
||||
isc_sockstatscounter_rawrecvfail = 60,
|
||||
isc_sockstatscounter_rawactive = 61,
|
||||
|
||||
isc_sockstatscounter_max = 62
|
||||
};
|
||||
|
||||
ISC_LANG_BEGINDECLS
|
||||
|
||||
/*%<
|
||||
|
@@ -27,6 +27,7 @@
|
||||
#include <isc/region.h>
|
||||
#include <isc/result.h>
|
||||
#include <isc/sockaddr.h>
|
||||
#include <isc/stats.h>
|
||||
#include <isc/thread.h>
|
||||
#include <isc/util.h>
|
||||
#include "uv-compat.h"
|
||||
@@ -265,6 +266,8 @@ struct isc_nm {
|
||||
isc_condition_t wkstatecond;
|
||||
isc__networker_t *workers;
|
||||
|
||||
isc_stats_t *stats;
|
||||
|
||||
isc_mempool_t *reqpool;
|
||||
isc_mutex_t reqlock;
|
||||
|
||||
@@ -320,6 +323,23 @@ typedef enum isc_nmsocket_type {
|
||||
#define NMSOCK_MAGIC ISC_MAGIC('N', 'M', 'S', 'K')
|
||||
#define VALID_NMSOCK(t) ISC_MAGIC_VALID(t, NMSOCK_MAGIC)
|
||||
|
||||
/*%
|
||||
* Index into socket stat counter arrays.
|
||||
*/
|
||||
enum {
|
||||
STATID_OPEN = 0,
|
||||
STATID_OPENFAIL = 1,
|
||||
STATID_CLOSE = 2,
|
||||
STATID_BINDFAIL = 3,
|
||||
STATID_CONNECTFAIL = 4,
|
||||
STATID_CONNECT = 5,
|
||||
STATID_ACCEPTFAIL = 6,
|
||||
STATID_ACCEPT = 7,
|
||||
STATID_SENDFAIL = 8,
|
||||
STATID_RECVFAIL = 9,
|
||||
STATID_ACTIVE = 10
|
||||
};
|
||||
|
||||
struct isc_nmsocket {
|
||||
/*% Unlocked, RO */
|
||||
int magic;
|
||||
@@ -338,6 +358,11 @@ struct isc_nmsocket {
|
||||
isc_quota_t *pquota;
|
||||
bool overquota;
|
||||
|
||||
/*%
|
||||
* Socket statistics
|
||||
*/
|
||||
const isc_statscounter_t *statsindex;
|
||||
|
||||
/*%
|
||||
* TCP read timeout timer.
|
||||
*/
|
||||
@@ -561,9 +586,10 @@ isc__nm_uvreq_put(isc__nm_uvreq_t **req, isc_nmsocket_t *sock);
|
||||
|
||||
void
|
||||
isc__nmsocket_init(isc_nmsocket_t *sock, isc_nm_t *mgr,
|
||||
isc_nmsocket_type type);
|
||||
isc_nmsocket_type type, isc_nmiface_t *iface);
|
||||
/*%<
|
||||
* Initialize socket 'sock', attach it to 'mgr', and set it to type 'type'.
|
||||
* Initialize socket 'sock', attach it to 'mgr', and set it to type 'type'
|
||||
* and its interface to 'iface'.
|
||||
*/
|
||||
|
||||
void
|
||||
@@ -691,3 +717,15 @@ isc__nm_acquire_interlocked_force(isc_nm_t *mgr);
|
||||
/*%<
|
||||
* Actively wait for interlocked state.
|
||||
*/
|
||||
|
||||
void
|
||||
isc__nm_incstats(isc_nm_t *mgr, isc_statscounter_t counterid);
|
||||
/*%<
|
||||
* Increment socket-related statistics counters.
|
||||
*/
|
||||
|
||||
void
|
||||
isc__nm_decstats(isc_nm_t *mgr, isc_statscounter_t counterid);
|
||||
/*%<
|
||||
* Decrement socket-related statistics counters.
|
||||
*/
|
||||
|
@@ -26,12 +26,90 @@
|
||||
#include <isc/region.h>
|
||||
#include <isc/result.h>
|
||||
#include <isc/sockaddr.h>
|
||||
#include <isc/stats.h>
|
||||
#include <isc/thread.h>
|
||||
#include <isc/util.h>
|
||||
|
||||
#include "uv-compat.h"
|
||||
#include "netmgr-int.h"
|
||||
|
||||
/*%
|
||||
* Shortcut index arrays to get access to statistics counters.
|
||||
*/
|
||||
|
||||
static const isc_statscounter_t udp4statsindex[] = {
|
||||
isc_sockstatscounter_udp4open,
|
||||
isc_sockstatscounter_udp4openfail,
|
||||
isc_sockstatscounter_udp4close,
|
||||
isc_sockstatscounter_udp4bindfail,
|
||||
isc_sockstatscounter_udp4connectfail,
|
||||
isc_sockstatscounter_udp4connect,
|
||||
-1,
|
||||
-1,
|
||||
isc_sockstatscounter_udp4sendfail,
|
||||
isc_sockstatscounter_udp4recvfail,
|
||||
isc_sockstatscounter_udp4active
|
||||
};
|
||||
|
||||
static const isc_statscounter_t udp6statsindex[] = {
|
||||
isc_sockstatscounter_udp6open,
|
||||
isc_sockstatscounter_udp6openfail,
|
||||
isc_sockstatscounter_udp6close,
|
||||
isc_sockstatscounter_udp6bindfail,
|
||||
isc_sockstatscounter_udp6connectfail,
|
||||
isc_sockstatscounter_udp6connect,
|
||||
-1,
|
||||
-1,
|
||||
isc_sockstatscounter_udp6sendfail,
|
||||
isc_sockstatscounter_udp6recvfail,
|
||||
isc_sockstatscounter_udp6active
|
||||
};
|
||||
|
||||
static const isc_statscounter_t tcp4statsindex[] = {
|
||||
isc_sockstatscounter_tcp4open,
|
||||
isc_sockstatscounter_tcp4openfail,
|
||||
isc_sockstatscounter_tcp4close,
|
||||
isc_sockstatscounter_tcp4bindfail,
|
||||
isc_sockstatscounter_tcp4connectfail,
|
||||
isc_sockstatscounter_tcp4connect,
|
||||
isc_sockstatscounter_tcp4acceptfail,
|
||||
isc_sockstatscounter_tcp4accept,
|
||||
isc_sockstatscounter_tcp4sendfail,
|
||||
isc_sockstatscounter_tcp4recvfail,
|
||||
isc_sockstatscounter_tcp4active
|
||||
};
|
||||
|
||||
static const isc_statscounter_t tcp6statsindex[] = {
|
||||
isc_sockstatscounter_tcp6open,
|
||||
isc_sockstatscounter_tcp6openfail,
|
||||
isc_sockstatscounter_tcp6close,
|
||||
isc_sockstatscounter_tcp6bindfail,
|
||||
isc_sockstatscounter_tcp6connectfail,
|
||||
isc_sockstatscounter_tcp6connect,
|
||||
isc_sockstatscounter_tcp6acceptfail,
|
||||
isc_sockstatscounter_tcp6accept,
|
||||
isc_sockstatscounter_tcp6sendfail,
|
||||
isc_sockstatscounter_tcp6recvfail,
|
||||
isc_sockstatscounter_tcp6active
|
||||
};
|
||||
|
||||
#if 0
|
||||
/* XXX: not currently used */
|
||||
static const isc_statscounter_t unixstatsindex[] = {
|
||||
isc_sockstatscounter_unixopen,
|
||||
isc_sockstatscounter_unixopenfail,
|
||||
isc_sockstatscounter_unixclose,
|
||||
isc_sockstatscounter_unixbindfail,
|
||||
isc_sockstatscounter_unixconnectfail,
|
||||
isc_sockstatscounter_unixconnect,
|
||||
isc_sockstatscounter_unixacceptfail,
|
||||
isc_sockstatscounter_unixaccept,
|
||||
isc_sockstatscounter_unixsendfail,
|
||||
isc_sockstatscounter_unixrecvfail,
|
||||
isc_sockstatscounter_unixactive
|
||||
};
|
||||
#endif
|
||||
|
||||
/*
|
||||
* libuv is not thread safe, but has mechanisms to pass messages
|
||||
* between threads. Each socket is owned by a thread. For UDP
|
||||
@@ -206,6 +284,10 @@ nm_destroy(isc_nm_t **mgr0) {
|
||||
isc_thread_join(worker->thread, NULL);
|
||||
}
|
||||
|
||||
if (mgr->stats != NULL) {
|
||||
isc_stats_detach(&mgr->stats);
|
||||
}
|
||||
|
||||
isc_condition_destroy(&mgr->wkstatecond);
|
||||
isc_mutex_destroy(&mgr->lock);
|
||||
|
||||
@@ -828,15 +910,25 @@ isc_nmsocket_detach(isc_nmsocket_t **sockp) {
|
||||
|
||||
void
|
||||
isc__nmsocket_init(isc_nmsocket_t *sock, isc_nm_t *mgr,
|
||||
isc_nmsocket_type type)
|
||||
isc_nmsocket_type type, isc_nmiface_t *iface)
|
||||
{
|
||||
uint16_t family;
|
||||
|
||||
REQUIRE(sock != NULL);
|
||||
REQUIRE(mgr != NULL);
|
||||
REQUIRE(iface!= NULL);
|
||||
|
||||
family = iface->addr.type.sa.sa_family;
|
||||
|
||||
*sock = (isc_nmsocket_t) {
|
||||
.type = type,
|
||||
.iface = iface,
|
||||
.fd = -1,
|
||||
.ah_size = 32,
|
||||
.inactivehandles = isc_astack_new(mgr->mctx, 60),
|
||||
.inactivereqs = isc_astack_new(mgr->mctx, 60)
|
||||
};
|
||||
|
||||
isc_nm_attach(mgr, &sock->mgr);
|
||||
sock->uv_handle.handle.data = sock;
|
||||
|
||||
@@ -850,6 +942,28 @@ isc__nmsocket_init(isc_nmsocket_t *sock, isc_nm_t *mgr,
|
||||
sock->ah_handles[i] = NULL;
|
||||
}
|
||||
|
||||
switch (type) {
|
||||
case isc_nm_udpsocket:
|
||||
case isc_nm_udplistener:
|
||||
if (family == AF_INET) {
|
||||
sock->statsindex = udp4statsindex;
|
||||
} else {
|
||||
sock->statsindex = udp6statsindex;
|
||||
}
|
||||
break;
|
||||
case isc_nm_tcpsocket:
|
||||
case isc_nm_tcplistener:
|
||||
case isc_nm_tcpchildlistener:
|
||||
if (family == AF_INET) {
|
||||
sock->statsindex = tcp4statsindex;
|
||||
} else {
|
||||
sock->statsindex = tcp6statsindex;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
isc_mutex_init(&sock->lock);
|
||||
isc_condition_init(&sock->cond);
|
||||
isc_refcount_init(&sock->references, 1);
|
||||
@@ -1291,3 +1405,33 @@ isc__nm_acquire_interlocked_force(isc_nm_t *mgr) {
|
||||
}
|
||||
UNLOCK(&mgr->lock);
|
||||
}
|
||||
|
||||
void
|
||||
isc_nm_setstats(isc_nm_t *mgr, isc_stats_t *stats) {
|
||||
REQUIRE(VALID_NM(mgr));
|
||||
REQUIRE(mgr->stats == NULL);
|
||||
REQUIRE(isc_stats_ncounters(stats) == isc_sockstatscounter_max);
|
||||
|
||||
isc_stats_attach(stats, &mgr->stats);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
isc__nm_incstats(isc_nm_t *mgr, isc_statscounter_t counterid) {
|
||||
REQUIRE(VALID_NM(mgr));
|
||||
REQUIRE(counterid != -1);
|
||||
|
||||
if (mgr->stats != NULL) {
|
||||
isc_stats_increment(mgr->stats, counterid);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
isc__nm_decstats(isc_nm_t *mgr, isc_statscounter_t counterid) {
|
||||
REQUIRE(VALID_NM(mgr));
|
||||
REQUIRE(counterid != -1);
|
||||
|
||||
if (mgr->stats != NULL) {
|
||||
isc_stats_decrement(mgr->stats, counterid);
|
||||
}
|
||||
}
|
||||
|
@@ -147,8 +147,7 @@ isc_nm_listentcp(isc_nm_t *mgr, isc_nmiface_t *iface,
|
||||
REQUIRE(VALID_NM(mgr));
|
||||
|
||||
nsock = isc_mem_get(mgr->mctx, sizeof(*nsock));
|
||||
isc__nmsocket_init(nsock, mgr, isc_nm_tcplistener);
|
||||
nsock->iface = iface;
|
||||
isc__nmsocket_init(nsock, mgr, isc_nm_tcplistener, iface);
|
||||
nsock->nchildren = mgr->nworkers;
|
||||
atomic_init(&nsock->rchildren, mgr->nworkers);
|
||||
nsock->children = isc_mem_get(mgr->mctx,
|
||||
@@ -223,9 +222,9 @@ isc__nm_async_tcplisten(isc__networker_t *worker, isc__netievent_t *ev0) {
|
||||
for (int i = 0; i < sock->nchildren; i++) {
|
||||
isc_nmsocket_t *csock = &sock->children[i];
|
||||
|
||||
isc__nmsocket_init(csock, sock->mgr, isc_nm_tcpchildlistener);
|
||||
isc__nmsocket_init(csock, sock->mgr,
|
||||
isc_nm_tcpchildlistener, sock->iface);
|
||||
csock->parent = sock;
|
||||
csock->iface = sock->iface;
|
||||
csock->tid = i;
|
||||
csock->pquota = sock->pquota;
|
||||
csock->backlog = sock->backlog;
|
||||
@@ -680,10 +679,9 @@ accept_connection(isc_nmsocket_t *ssock) {
|
||||
}
|
||||
|
||||
csock = isc_mem_get(ssock->mgr->mctx, sizeof(isc_nmsocket_t));
|
||||
isc__nmsocket_init(csock, ssock->mgr, isc_nm_tcpsocket);
|
||||
isc__nmsocket_init(csock, ssock->mgr, isc_nm_tcpsocket, ssock->iface);
|
||||
csock->tid = isc_nm_tid();
|
||||
csock->extrahandlesize = ssock->extrahandlesize;
|
||||
csock->iface = ssock->iface;
|
||||
csock->quota = quota;
|
||||
quota = NULL;
|
||||
|
||||
|
@@ -118,7 +118,8 @@ dnslisten_acceptcb(isc_nmhandle_t *handle, isc_result_t result, void *cbarg) {
|
||||
|
||||
/* We need to create a 'wrapper' dnssocket for this connection */
|
||||
dnssock = isc_mem_get(handle->sock->mgr->mctx, sizeof(*dnssock));
|
||||
isc__nmsocket_init(dnssock, handle->sock->mgr, isc_nm_tcpdnssocket);
|
||||
isc__nmsocket_init(dnssock, handle->sock->mgr,
|
||||
isc_nm_tcpdnssocket, handle->sock->iface);
|
||||
|
||||
/* We need to copy read callbacks from outer socket */
|
||||
dnssock->rcb.recv = dnslistensock->rcb.recv;
|
||||
@@ -126,7 +127,6 @@ dnslisten_acceptcb(isc_nmhandle_t *handle, isc_result_t result, void *cbarg) {
|
||||
dnssock->extrahandlesize = dnslistensock->extrahandlesize;
|
||||
isc_nmsocket_attach(handle->sock, &dnssock->outer);
|
||||
dnssock->peer = handle->sock->peer;
|
||||
dnssock->iface = handle->sock->iface;
|
||||
dnssock->read_timeout = handle->sock->mgr->init;
|
||||
dnssock->tid = isc_nm_tid();
|
||||
dnssock->closehandle_cb = resume_processing;
|
||||
@@ -293,8 +293,7 @@ isc_nm_listentcpdns(isc_nm_t *mgr, isc_nmiface_t *iface,
|
||||
|
||||
REQUIRE(VALID_NM(mgr));
|
||||
|
||||
isc__nmsocket_init(dnslistensock, mgr, isc_nm_tcpdnslistener);
|
||||
dnslistensock->iface = iface;
|
||||
isc__nmsocket_init(dnslistensock, mgr, isc_nm_tcpdnslistener, iface);
|
||||
dnslistensock->rcb.recv = cb;
|
||||
dnslistensock->rcbarg = cbarg;
|
||||
dnslistensock->accept_cb.accept = accept_cb;
|
||||
|
@@ -54,8 +54,7 @@ isc_nm_listenudp(isc_nm_t *mgr, isc_nmiface_t *iface,
|
||||
* socket for each worker thread.
|
||||
*/
|
||||
nsock = isc_mem_get(mgr->mctx, sizeof(isc_nmsocket_t));
|
||||
isc__nmsocket_init(nsock, mgr, isc_nm_udplistener);
|
||||
nsock->iface = iface;
|
||||
isc__nmsocket_init(nsock, mgr, isc_nm_udplistener, iface);
|
||||
nsock->nchildren = mgr->nworkers;
|
||||
atomic_init(&nsock->rchildren, mgr->nworkers);
|
||||
nsock->children = isc_mem_get(mgr->mctx,
|
||||
@@ -74,9 +73,8 @@ isc_nm_listenudp(isc_nm_t *mgr, isc_nmiface_t *iface,
|
||||
isc__netievent_udplisten_t *ievent = NULL;
|
||||
isc_nmsocket_t *csock = &nsock->children[i];
|
||||
|
||||
isc__nmsocket_init(csock, mgr, isc_nm_udpsocket);
|
||||
isc__nmsocket_init(csock, mgr, isc_nm_udpsocket, iface);
|
||||
csock->parent = nsock;
|
||||
csock->iface = iface;
|
||||
csock->tid = i;
|
||||
csock->extrahandlesize = extrahandlesize;
|
||||
|
||||
|
@@ -450,6 +450,7 @@ isc_nm_listentcpdns
|
||||
isc_nm_listenudp
|
||||
isc_nm_maxudp
|
||||
isc_nm_send
|
||||
isc_nm_setstats
|
||||
isc_nm_start
|
||||
isc_nm_tcp_gettimeouts
|
||||
isc_nm_tcp_settimeouts
|
||||
|
Reference in New Issue
Block a user