mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-09-03 16:15:27 +00:00
When the client informs the dispatcher of a received response, have the
dispatcher copy the event instead of reusing the original one.
This commit is contained in:
@@ -15,7 +15,7 @@
|
||||
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: client.c,v 1.145 2001/02/09 21:25:55 gson Exp $ */
|
||||
/* $Id: client.c,v 1.146 2001/02/10 02:00:08 bwelling Exp $ */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
@@ -1228,7 +1228,7 @@ client_request(isc_task_t *task, isc_event_t *event) {
|
||||
ns_client_next(client, DNS_R_FORMERR);
|
||||
goto cleanup_serverlock;
|
||||
} else {
|
||||
dns_dispatch_importrecv(client->dispatch, &event);
|
||||
dns_dispatch_importrecv(client->dispatch, event);
|
||||
ns_client_next(client, ISC_R_SUCCESS);
|
||||
goto cleanup_serverlock;
|
||||
}
|
||||
@@ -1460,7 +1460,6 @@ client_request(isc_task_t *task, isc_event_t *event) {
|
||||
dns_zonemgr_unlockconf(ns_g_server->zonemgr, isc_rwlocktype_read);
|
||||
RWUNLOCK(&ns_g_server->conflock, isc_rwlocktype_read);
|
||||
|
||||
if (event != NULL)
|
||||
isc_event_free(&event);
|
||||
}
|
||||
|
||||
|
@@ -15,7 +15,7 @@
|
||||
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: dispatch.c,v 1.92 2001/02/09 00:23:12 gson Exp $ */
|
||||
/* $Id: dispatch.c,v 1.93 2001/02/10 02:00:09 bwelling Exp $ */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
@@ -2054,29 +2054,40 @@ dns_dispatch_changeattributes(dns_dispatch_t *disp,
|
||||
}
|
||||
|
||||
void
|
||||
dns_dispatch_importrecv(dns_dispatch_t *disp, isc_event_t **eventp) {
|
||||
dns_dispatch_importrecv(dns_dispatch_t *disp, isc_event_t *event) {
|
||||
void *buf;
|
||||
isc_socketevent_t *sevent;
|
||||
isc_socketevent_t *sevent, *newsevent;
|
||||
|
||||
REQUIRE(VALID_DISPATCH(disp));
|
||||
REQUIRE((disp->attributes & DNS_DISPATCHATTR_NOLISTEN) != 0);
|
||||
REQUIRE(eventp != NULL && *eventp != NULL);
|
||||
REQUIRE(event != NULL);
|
||||
|
||||
sevent = (isc_socketevent_t *)*eventp;
|
||||
sevent = (isc_socketevent_t *)event;
|
||||
|
||||
INSIST(sevent->n <= disp->mgr->buffersize);
|
||||
newsevent = (isc_socketevent_t *)
|
||||
isc_event_allocate(disp->mgr->mctx, NULL,
|
||||
ISC_SOCKEVENT_RECVDONE, udp_recv,
|
||||
disp, sizeof(isc_socketevent_t));
|
||||
if (newsevent == NULL)
|
||||
return;
|
||||
|
||||
buf = allocate_udp_buffer(disp);
|
||||
if (buf == NULL) {
|
||||
isc_event_free(eventp);
|
||||
isc_event_free((isc_event_t **)&newsevent);
|
||||
return;
|
||||
}
|
||||
memcpy(buf, sevent->region.base, sevent->n);
|
||||
sevent->region.base = buf;
|
||||
sevent->region.length = disp->mgr->buffersize;
|
||||
sevent->ev_action = udp_recv;
|
||||
sevent->ev_arg = disp;
|
||||
sevent->ev_sender = NULL;
|
||||
isc_task_send(disp->task, eventp);
|
||||
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, (isc_event_t **)&newsevent);
|
||||
}
|
||||
|
||||
#if 0
|
||||
|
@@ -15,7 +15,7 @@
|
||||
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: dispatch.h,v 1.41 2001/02/09 00:23:16 gson Exp $ */
|
||||
/* $Id: dispatch.h,v 1.42 2001/02/10 02:00:11 bwelling Exp $ */
|
||||
|
||||
#ifndef DNS_DISPATCH_H
|
||||
#define DNS_DISPATCH_H 1
|
||||
@@ -408,15 +408,15 @@ dns_dispatch_changeattributes(dns_dispatch_t *disp,
|
||||
*/
|
||||
|
||||
void
|
||||
dns_dispatch_importrecv(dns_dispatch_t *disp, isc_event_t **eventp);
|
||||
dns_dispatch_importrecv(dns_dispatch_t *disp, isc_event_t *event);
|
||||
/*
|
||||
* Give a socket receive event to the dispatcher. This is used for sockets
|
||||
* shared between dispatchers and clients. If the dispatcher fails to send
|
||||
* the event, it frees it.
|
||||
* 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.
|
||||
*
|
||||
* Requires:
|
||||
* disp is valid, and the attribute DNS_DISPATCHATTR_NOLISTEN is set.
|
||||
* eventp != NULL && *eventp != NULL
|
||||
* event != NULL
|
||||
*/
|
||||
|
||||
ISC_LANG_ENDDECLS
|
||||
|
Reference in New Issue
Block a user