2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-09-01 06:55:30 +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 */

View File

@@ -122,11 +122,6 @@ struct dns_dispatchset {
* The dispatcher can be used to issue queries to other servers, and
* accept replies from them.
*
* _RANDOMPORT
* Previously used to indicate that the port of a dispatch UDP must be
* chosen randomly. This behavior now always applies and the attribute
* is obsoleted.
*
* _EXCLUSIVE
* A separate socket will be used on-demand for each transaction.
*/
@@ -429,15 +424,6 @@ dns_dispatch_getlocaladdress(dns_dispatch_t *disp, isc_sockaddr_t *addrp);
*\li ISC_R_NOTIMPLEMENTED
*/
void
dns_dispatch_cancel(dns_dispatch_t *disp);
/*%<
* cancel outstanding clients
*
* Requires:
*\li disp is valid.
*/
unsigned int
dns_dispatch_getattributes(dns_dispatch_t *disp);
/*%<
@@ -473,21 +459,6 @@ dns_dispatch_changeattributes(dns_dispatch_t *disp, unsigned int attributes,
* attribute on a TCP socket isn't reasonable.
*/
void
dns_dispatch_importrecv(dns_dispatch_t *disp, isc_event_t *event);
/*%<
* Inform the dispatcher of a socket receive. This is used for sockets
* shared between dispatchers and clients. If the dispatcher fails to copy
* or send the event, nothing happens.
*
* If the attribute DNS_DISPATCHATTR_NOLISTEN is not set, then
* the dispatch is already handling a recv; return immediately.
*
* Requires:
*\li disp is valid, and the attribute DNS_DISPATCHATTR_NOLISTEN is set.
* event != NULL
*/
dns_dispatch_t *
dns_dispatchset_get(dns_dispatchset_t *dset);
/*%<
@@ -528,18 +499,6 @@ dns_dispatchset_destroy(dns_dispatchset_t **dsetp);
*\li dset is valid
*/
void
dns_dispatch_setdscp(dns_dispatch_t *disp, isc_dscp_t dscp);
isc_dscp_t
dns_dispatch_getdscp(dns_dispatch_t *disp);
/*%<
* Set/get the DSCP value to be used when sending responses to clients,
* as defined in the "listen-on" or "listen-on-v6" statements.
*
* Requires:
*\li disp is valid.
*/
isc_result_t
dns_dispatch_getnext(dns_dispentry_t *resp, dns_dispatchevent_t **sockevent);
/*%<

View File

@@ -54,7 +54,7 @@
#define DNS_EVENT_DISPATCHCONTROL (ISC_EVENTCLASS_DNS + 32)
#define DNS_EVENT_REQUESTCONTROL (ISC_EVENTCLASS_DNS + 33)
#define DNS_EVENT_DUMPQUANTUM (ISC_EVENTCLASS_DNS + 34)
#define DNS_EVENT_IMPORTRECVDONE (ISC_EVENTCLASS_DNS + 35)
/* #define DNS_EVENT_IMPORTRECVDONE (ISC_EVENTCLASS_DNS + 35) */
#define DNS_EVENT_FREESTORAGE (ISC_EVENTCLASS_DNS + 36)
#define DNS_EVENT_VIEWACACHESHUTDOWN (ISC_EVENTCLASS_DNS + 37)
#define DNS_EVENT_ACACHECONTROL (ISC_EVENTCLASS_DNS + 38)