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

Remove unused code in dispatch.c

Some routines in dispatch.c are obsolete and unused; clean them up
before porting to netmgr.
This commit is contained in:
Evan Hunt
2020-12-09 12:52:31 -08:00
committed by Ondřej Surý
parent a480522f6e
commit c69f2018a3
3 changed files with 3 additions and 132 deletions

View File

@@ -208,10 +208,8 @@ struct dns_dispatch {
unsigned int refcount; /*%< number of users */
dns_dispatchevent_t *failsafe_ev; /*%< failsafe cancel event */
unsigned int shutting_down : 1, shutdown_out : 1, connected : 1,
tcpmsg_valid : 1, recv_pending : 1; /*%< is a
* recv()
* pending?
* */
tcpmsg_valid : 1, recv_pending : 1; /*%< is a recv() pending? *
*/
isc_result_t shutdown_why;
ISC_LIST(dispsocket_t) activesockets;
ISC_LIST(dispsocket_t) inactivesockets;
@@ -2385,10 +2383,8 @@ dns_dispatch_getudp(dns_dispatchmgr_t *mgr, isc_socketmgr_t *sockmgr,
if ((attributes & DNS_DISPATCHATTR_EXCLUSIVE) != 0) {
REQUIRE(isc_sockaddr_getport(localaddr) == 0);
goto createudp;
}
createudp:
/*
* Nope, create one.
*/
@@ -3178,26 +3174,6 @@ dns_dispatch_getlocaladdress(dns_dispatch_t *disp, isc_sockaddr_t *addrp) {
return (ISC_R_NOTIMPLEMENTED);
}
void
dns_dispatch_cancel(dns_dispatch_t *disp) {
REQUIRE(VALID_DISPATCH(disp));
LOCK(&disp->lock);
if (disp->shutting_down == 1) {
UNLOCK(&disp->lock);
return;
}
disp->shutdown_why = ISC_R_CANCELED;
disp->shutting_down = 1;
do_cancel(disp);
UNLOCK(&disp->lock);
return;
}
unsigned int
dns_dispatch_getattributes(dns_dispatch_t *disp) {
REQUIRE(VALID_DISPATCH(disp));
@@ -3248,43 +3224,6 @@ dns_dispatch_changeattributes(dns_dispatch_t *disp, unsigned int attributes,
UNLOCK(&disp->lock);
}
void
dns_dispatch_importrecv(dns_dispatch_t *disp, isc_event_t *event) {
void *buf;
isc_socketevent_t *sevent, *newsevent;
REQUIRE(VALID_DISPATCH(disp));
REQUIRE(event != NULL);
if ((disp->attributes & DNS_DISPATCHATTR_NOLISTEN) == 0) {
return;
}
sevent = (isc_socketevent_t *)event;
INSIST(sevent->n <= disp->mgr->buffersize);
newsevent = (isc_socketevent_t *)isc_event_allocate(
disp->mgr->mctx, NULL, DNS_EVENT_IMPORTRECVDONE, udp_shrecv,
disp, sizeof(isc_socketevent_t));
buf = allocate_udp_buffer(disp);
if (buf == NULL) {
isc_event_free(ISC_EVENT_PTR(&newsevent));
return;
}
memmove(buf, sevent->region.base, sevent->n);
newsevent->region.base = buf;
newsevent->region.length = disp->mgr->buffersize;
newsevent->n = sevent->n;
newsevent->result = sevent->result;
newsevent->address = sevent->address;
newsevent->timestamp = sevent->timestamp;
newsevent->pktinfo = sevent->pktinfo;
newsevent->attributes = sevent->attributes;
isc_task_send(disp->task[0], ISC_EVENT_PTR(&newsevent));
}
dns_dispatch_t *
dns_dispatchset_get(dns_dispatchset_t *dset) {
dns_dispatch_t *disp;
@@ -3397,30 +3336,3 @@ dns_dispatchset_destroy(dns_dispatchset_t **dsetp) {
isc_mutex_destroy(&dset->lock);
isc_mem_putanddetach(&dset->mctx, dset, sizeof(dns_dispatchset_t));
}
void
dns_dispatch_setdscp(dns_dispatch_t *disp, isc_dscp_t dscp) {
REQUIRE(VALID_DISPATCH(disp));
disp->dscp = dscp;
}
isc_dscp_t
dns_dispatch_getdscp(dns_dispatch_t *disp) {
REQUIRE(VALID_DISPATCH(disp));
return (disp->dscp);
}
#if 0
void
dns_dispatchmgr_dump(dns_dispatchmgr_t *mgr) {
dns_dispatch_t *disp;
char foo[1024];
disp = ISC_LIST_HEAD(mgr->list);
while (disp != NULL) {
isc_sockaddr_format(&disp->local, foo, sizeof(foo));
printf("\tdispatch %p, addr %s\n", disp, foo);
disp = ISC_LIST_NEXT(disp, link);
}
}
#endif /* if 0 */