mirror of
https://github.com/isc-projects/bind9.git
synced 2026-06-11 13:50:00 -04:00
Merge branch '3766-pin-TCP-dispatch-to-threads' into 'main'
Pin the dns_dispatch to threads when reusing Closes #3766 See merge request isc-projects/bind9!7299
This commit is contained in:
commit
06b70e0927
1 changed files with 9 additions and 1 deletions
|
|
@ -29,6 +29,7 @@
|
|||
#include <isc/random.h>
|
||||
#include <isc/stats.h>
|
||||
#include <isc/string.h>
|
||||
#include <isc/tid.h>
|
||||
#include <isc/time.h>
|
||||
#include <isc/tls.h>
|
||||
#include <isc/util.h>
|
||||
|
|
@ -109,7 +110,8 @@ struct dns_dispentry {
|
|||
|
||||
struct dns_dispatch {
|
||||
/* Unlocked. */
|
||||
unsigned int magic; /*%< magic */
|
||||
unsigned int magic; /*%< magic */
|
||||
uint32_t tid;
|
||||
dns_dispatchmgr_t *mgr; /*%< dispatch manager */
|
||||
isc_nmhandle_t *handle; /*%< netmgr handle for TCP connection */
|
||||
isc_sockaddr_t local; /*%< local address */
|
||||
|
|
@ -1160,6 +1162,7 @@ dispatch_allocate(dns_dispatchmgr_t *mgr, isc_socktype_t type,
|
|||
.link = ISC_LINK_INITIALIZER,
|
||||
.active = ISC_LIST_INITIALIZER,
|
||||
.pending = ISC_LIST_INITIALIZER,
|
||||
.tid = isc_tid(),
|
||||
.magic = DISPATCH_MAGIC,
|
||||
};
|
||||
|
||||
|
|
@ -1245,6 +1248,11 @@ dns_dispatch_gettcp(dns_dispatchmgr_t *mgr, const isc_sockaddr_t *destaddr,
|
|||
|
||||
LOCK(&disp->lock);
|
||||
|
||||
if (disp->tid != isc_tid()) {
|
||||
UNLOCK(&disp->lock);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (disp->handle != NULL) {
|
||||
sockname = isc_nmhandle_localaddr(disp->handle);
|
||||
peeraddr = isc_nmhandle_peeraddr(disp->handle);
|
||||
|
|
|
|||
Loading…
Reference in a new issue