@@ -111,34 +111,24 @@ STATIC_ASSERT(ISC_NETMGR_TCP_RECVBUF_SIZE <= ISC_NETMGR_RECVBUF_SIZE,
111
111
#define NM_MAXSEG (1280 - 20 - 40)
112
112
113
113
/*
114
- * Define NETMGR_TRACE to activate tracing of handles and sockets.
114
+ * Define ISC_NETMGR_TRACE to activate tracing of handles and sockets.
115
115
* This will impair performance but enables us to quickly determine,
116
116
* if netmgr resources haven't been cleaned up on shutdown, which ones
117
117
* are still in use.
118
118
*/
119
- #ifdef NETMGR_TRACE
119
+ #if ISC_NETMGR_TRACE
120
120
#define TRACE_SIZE 8
121
121
122
- void
123
- isc__nm_dump_active (isc_nm_t * nm );
124
-
125
122
#if defined(__linux__ )
126
123
#include <syscall.h>
127
124
#define gettid () (uint32_t) syscall(SYS_gettid)
128
125
#else
129
126
#define gettid () (uint32_t) pthread_self()
130
127
#endif
131
128
132
- #ifdef NETMGR_TRACE_VERBOSE
133
129
#define NETMGR_TRACE_LOG (format , ...) \
134
130
fprintf(stderr, "%" PRIu32 ":%d:%s:%u:%s:" format, gettid(), \
135
131
isc_tid(), file, line, func, __VA_ARGS__)
136
- #else
137
- #define NETMGR_TRACE_LOG (format , ...) \
138
- (void)file; \
139
- (void)line; \
140
- (void)func;
141
- #endif
142
132
143
133
#define FLARG_PASS , file, line, func
144
134
#define FLARG \
@@ -157,9 +147,9 @@ isc__nm_dump_active(isc_nm_t *nm);
157
147
isc___nm_uvreq_get(req, sock, __FILE__, __LINE__, __func__)
158
148
#define isc__nm_uvreq_put (req , sock ) \
159
149
isc___nm_uvreq_put(req, sock, __FILE__, __LINE__, __func__)
160
- #define isc__nmsocket_init (sock , mgr , type , iface ) \
161
- isc___nmsocket_init(sock, mgr, type, iface, __FILE__, __LINE__ , \
162
- __func__)
150
+ #define isc__nmsocket_init (sock , mgr , type , iface , parent ) \
151
+ isc___nmsocket_init(sock, mgr, type, iface, parent, __FILE__ , \
152
+ __LINE__, __func__)
163
153
#define isc__nmsocket_put (sockp ) \
164
154
isc___nmsocket_put(sockp, __FILE__, __LINE__, __func__)
165
155
#define isc__nmsocket_attach (sock , target ) \
@@ -181,8 +171,8 @@ isc__nm_dump_active(isc_nm_t *nm);
181
171
#define FLARG_IEVENT_PASS (ievent )
182
172
#define isc__nm_uvreq_get (req , sock ) isc___nm_uvreq_get(req, sock)
183
173
#define isc__nm_uvreq_put (req , sock ) isc___nm_uvreq_put(req, sock)
184
- #define isc__nmsocket_init (sock , mgr , type , iface ) \
185
- isc___nmsocket_init(sock, mgr, type, iface)
174
+ #define isc__nmsocket_init (sock , mgr , type , iface , parent ) \
175
+ isc___nmsocket_init(sock, mgr, type, iface, parent )
186
176
#define isc__nmsocket_put (sockp ) isc___nmsocket_put(sockp)
187
177
#define isc__nmsocket_attach (sock , target ) isc___nmsocket_attach(sock, target)
188
178
#define isc__nmsocket_detach (socketp ) isc___nmsocket_detach(socketp)
@@ -208,10 +198,16 @@ typedef struct isc__networker {
208
198
char * recvbuf ;
209
199
char * sendbuf ;
210
200
bool recvbuf_inuse ;
201
+
202
+ ISC_LIST (isc_nmsocket_t ) active_sockets ;
203
+
211
204
} isc__networker_t ;
212
205
213
206
ISC_REFCOUNT_DECL (isc__networker );
214
207
208
+ void
209
+ isc__nm_dump_active (isc__networker_t * worker );
210
+
215
211
/*
216
212
* A general handle for a connection bound to a networker. For UDP
217
213
* connections we have peer address here, so both TCP and UDP can be
@@ -244,11 +240,11 @@ struct isc_nmhandle {
244
240
isc_sockaddr_t local ;
245
241
isc_nm_opaquecb_t doreset ; /* reset extra callback, external */
246
242
isc_nm_opaquecb_t dofree ; /* free extra callback, external */
247
- #ifdef NETMGR_TRACE
243
+ #if ISC_NETMGR_TRACE
248
244
void * backtrace [TRACE_SIZE ];
249
245
int backtrace_size ;
250
- LINK (isc_nmhandle_t ) active_link ;
251
246
#endif
247
+ LINK (isc_nmhandle_t ) active_link ;
252
248
void * opaque ;
253
249
};
254
250
@@ -700,10 +696,6 @@ struct isc_nm {
700
696
atomic_int_fast32_t send_udp_buffer_size ;
701
697
atomic_int_fast32_t recv_tcp_buffer_size ;
702
698
atomic_int_fast32_t send_tcp_buffer_size ;
703
-
704
- #ifdef NETMGR_TRACE
705
- ISC_LIST (isc_nmsocket_t ) active_sockets ;
706
- #endif
707
699
};
708
700
709
701
/*%
@@ -1030,13 +1022,12 @@ struct isc_nmsocket {
1030
1022
1031
1023
bool barriers_initialised ;
1032
1024
bool manual_read_timer ;
1033
- #ifdef NETMGR_TRACE
1025
+ #if ISC_NETMGR_TRACE
1034
1026
void * backtrace [TRACE_SIZE ];
1035
1027
int backtrace_size ;
1028
+ #endif
1036
1029
LINK (isc_nmsocket_t ) active_link ;
1037
1030
ISC_LIST (isc_nmhandle_t ) active_handles ;
1038
- isc_mutex_t tracelock ;
1039
- #endif
1040
1031
};
1041
1032
1042
1033
void
@@ -1070,8 +1061,8 @@ isc__nm_free_uvbuf(isc_nmsocket_t *sock, const uv_buf_t *buf);
1070
1061
*/
1071
1062
1072
1063
isc_nmhandle_t *
1073
- isc___nmhandle_get (isc_nmsocket_t * sock , isc_sockaddr_t * peer ,
1074
- isc_sockaddr_t * local FLARG );
1064
+ isc___nmhandle_get (isc_nmsocket_t * sock , isc_sockaddr_t const * peer ,
1065
+ isc_sockaddr_t const * local FLARG );
1075
1066
/*%<
1076
1067
* Get a handle for the socket 'sock', allocating a new one
1077
1068
* if there isn't one available in 'sock->inactivehandles'.
@@ -1104,7 +1095,8 @@ isc___nm_uvreq_put(isc__nm_uvreq_t **req, isc_nmsocket_t *sock FLARG);
1104
1095
1105
1096
void
1106
1097
isc___nmsocket_init (isc_nmsocket_t * sock , isc__networker_t * worker ,
1107
- isc_nmsocket_type type , isc_sockaddr_t * iface FLARG );
1098
+ isc_nmsocket_type type , isc_sockaddr_t * iface ,
1099
+ isc_nmsocket_t * parent FLARG );
1108
1100
/*%<
1109
1101
* Initialize socket 'sock', attach it to 'mgr', and set it to type 'type'
1110
1102
* and its interface to 'iface'.
0 commit comments