mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-29 05:28:00 +00:00
[master] avoid active-counter underflow
3472. [bug] The active-connections counter in the socket statistics could underflow. [RT #31747] (cherry picked from commit 4dfe072abe4e76f5078a38ea0b97800333290877)
This commit is contained in:
parent
2154c01912
commit
641e87a1a0
3
CHANGES
3
CHANGES
@ -1,3 +1,6 @@
|
|||||||
|
3472. [bug] The active-connections counter in the socket
|
||||||
|
statistics could underflow. [RT #31747]
|
||||||
|
|
||||||
3471. [bug] The number of UDP dispatches now defaults to
|
3471. [bug] The number of UDP dispatches now defaults to
|
||||||
the number of CPUs even if -n has been set to
|
the number of CPUs even if -n has been set to
|
||||||
a higher value. [RT #30964]
|
a higher value. [RT #30964]
|
||||||
|
@ -326,16 +326,17 @@ struct isc__socket {
|
|||||||
intev_t readable_ev;
|
intev_t readable_ev;
|
||||||
intev_t writable_ev;
|
intev_t writable_ev;
|
||||||
|
|
||||||
isc_sockaddr_t peer_address; /* remote address */
|
isc_sockaddr_t peer_address; /* remote address */
|
||||||
|
|
||||||
unsigned int pending_recv : 1,
|
unsigned int pending_recv : 1,
|
||||||
pending_send : 1,
|
pending_send : 1,
|
||||||
pending_accept : 1,
|
pending_accept : 1,
|
||||||
listener : 1, /* listener socket */
|
listener : 1, /* listener socket */
|
||||||
connected : 1,
|
connected : 1,
|
||||||
connecting : 1, /* connect pending */
|
connecting : 1, /* connect pending */
|
||||||
bound : 1, /* bound to local addr */
|
bound : 1, /* bound to local addr */
|
||||||
dupped : 1;
|
dupped : 1,
|
||||||
|
active : 1; /* currently active */
|
||||||
|
|
||||||
#ifdef ISC_NET_RECVOVERFLOW
|
#ifdef ISC_NET_RECVOVERFLOW
|
||||||
unsigned char overflow; /* used for MSG_TRUNC fake */
|
unsigned char overflow; /* used for MSG_TRUNC fake */
|
||||||
@ -1995,7 +1996,10 @@ closesocket(isc__socketmgr_t *manager, isc__socket_t *sock, int fd) {
|
|||||||
select_poke(manager, fd, SELECT_POKE_CLOSE);
|
select_poke(manager, fd, SELECT_POKE_CLOSE);
|
||||||
|
|
||||||
inc_stats(manager->stats, sock->statsindex[STATID_CLOSE]);
|
inc_stats(manager->stats, sock->statsindex[STATID_CLOSE]);
|
||||||
dec_stats(manager->stats, sock->statsindex[STATID_ACTIVE]);
|
if (sock->active == 1) {
|
||||||
|
dec_stats(manager->stats, sock->statsindex[STATID_ACTIVE]);
|
||||||
|
sock->active = 0;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* update manager->maxfd here (XXX: this should be implemented more
|
* update manager->maxfd here (XXX: this should be implemented more
|
||||||
@ -2582,7 +2586,11 @@ opensocket(isc__socketmgr_t *manager, isc__socket_t *sock,
|
|||||||
|
|
||||||
setup_done:
|
setup_done:
|
||||||
inc_stats(manager->stats, sock->statsindex[STATID_OPEN]);
|
inc_stats(manager->stats, sock->statsindex[STATID_OPEN]);
|
||||||
inc_stats(manager->stats, sock->statsindex[STATID_ACTIVE]);
|
if (sock->active == 0) {
|
||||||
|
inc_stats(manager->stats, sock->statsindex[STATID_ACTIVE]);
|
||||||
|
sock->active = 1;
|
||||||
|
}
|
||||||
|
|
||||||
return (ISC_R_SUCCESS);
|
return (ISC_R_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2625,6 +2633,7 @@ socket_create(isc_socketmgr_t *manager0, int pf, isc_sockettype_t type,
|
|||||||
INSIST(0);
|
INSIST(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sock->active = 0;
|
||||||
sock->pf = pf;
|
sock->pf = pf;
|
||||||
|
|
||||||
result = opensocket(manager, sock, (isc__socket_t *)dup_socket);
|
result = opensocket(manager, sock, (isc__socket_t *)dup_socket);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user