2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-31 22:45:39 +00:00

netmgr: refactor isc__nm_incstats() and isc__nm_decstats()

After support for route/netlink sockets is merged, not all sockets
will have stats counters associated with them, so it's now necessary
to check whether socket stats exist before incrementing or decrementing
them. rather than relying on the caller for this, we now just pass the
socket and an index, and the correct stats counter will be updated if
it exists.
This commit is contained in:
Evan Hunt
2021-10-02 16:26:43 -07:00
parent 5307b663b2
commit 8d6bf826c6
6 changed files with 103 additions and 108 deletions

View File

@@ -732,7 +732,7 @@ typedef enum isc_nmsocket_type {
/*%
* Index into socket stat counter arrays.
*/
enum {
typedef enum {
STATID_OPEN = 0,
STATID_OPENFAIL = 1,
STATID_CLOSE = 2,
@@ -743,8 +743,9 @@ enum {
STATID_ACCEPT = 7,
STATID_SENDFAIL = 8,
STATID_RECVFAIL = 9,
STATID_ACTIVE = 10
};
STATID_ACTIVE = 10,
STATID_MAX = 11,
} isc__nm_statid_t;
#if HAVE_LIBNGHTTP2
typedef struct isc_nmsocket_tls_send_req {
@@ -1755,13 +1756,13 @@ isc__nm_acquire_interlocked_force(isc_nm_t *mgr);
*/
void
isc__nm_incstats(isc_nm_t *mgr, isc_statscounter_t counterid);
isc__nm_incstats(isc_nmsocket_t *sock, isc__nm_statid_t id);
/*%<
* Increment socket-related statistics counters.
*/
void
isc__nm_decstats(isc_nm_t *mgr, isc_statscounter_t counterid);
isc__nm_decstats(isc_nmsocket_t *sock, isc__nm_statid_t id);
/*%<
* Decrement socket-related statistics counters.
*/