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.
|
* 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>
|
#include <config.h>
|
||||||
|
|
||||||
@@ -1228,7 +1228,7 @@ client_request(isc_task_t *task, isc_event_t *event) {
|
|||||||
ns_client_next(client, DNS_R_FORMERR);
|
ns_client_next(client, DNS_R_FORMERR);
|
||||||
goto cleanup_serverlock;
|
goto cleanup_serverlock;
|
||||||
} else {
|
} else {
|
||||||
dns_dispatch_importrecv(client->dispatch, &event);
|
dns_dispatch_importrecv(client->dispatch, event);
|
||||||
ns_client_next(client, ISC_R_SUCCESS);
|
ns_client_next(client, ISC_R_SUCCESS);
|
||||||
goto cleanup_serverlock;
|
goto cleanup_serverlock;
|
||||||
}
|
}
|
||||||
@@ -1460,8 +1460,7 @@ client_request(isc_task_t *task, isc_event_t *event) {
|
|||||||
dns_zonemgr_unlockconf(ns_g_server->zonemgr, isc_rwlocktype_read);
|
dns_zonemgr_unlockconf(ns_g_server->zonemgr, isc_rwlocktype_read);
|
||||||
RWUNLOCK(&ns_g_server->conflock, isc_rwlocktype_read);
|
RWUNLOCK(&ns_g_server->conflock, isc_rwlocktype_read);
|
||||||
|
|
||||||
if (event != NULL)
|
isc_event_free(&event);
|
||||||
isc_event_free(&event);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@@ -15,7 +15,7 @@
|
|||||||
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
* 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>
|
#include <config.h>
|
||||||
|
|
||||||
@@ -2054,29 +2054,40 @@ dns_dispatch_changeattributes(dns_dispatch_t *disp,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
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;
|
void *buf;
|
||||||
isc_socketevent_t *sevent;
|
isc_socketevent_t *sevent, *newsevent;
|
||||||
|
|
||||||
REQUIRE(VALID_DISPATCH(disp));
|
REQUIRE(VALID_DISPATCH(disp));
|
||||||
REQUIRE((disp->attributes & DNS_DISPATCHATTR_NOLISTEN) != 0);
|
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);
|
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);
|
buf = allocate_udp_buffer(disp);
|
||||||
if (buf == NULL) {
|
if (buf == NULL) {
|
||||||
isc_event_free(eventp);
|
isc_event_free((isc_event_t **)&newsevent);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
memcpy(buf, sevent->region.base, sevent->n);
|
memcpy(buf, sevent->region.base, sevent->n);
|
||||||
sevent->region.base = buf;
|
newsevent->region.base = buf;
|
||||||
sevent->region.length = disp->mgr->buffersize;
|
newsevent->region.length = disp->mgr->buffersize;
|
||||||
sevent->ev_action = udp_recv;
|
newsevent->n = sevent->n;
|
||||||
sevent->ev_arg = disp;
|
newsevent->result = sevent->result;
|
||||||
sevent->ev_sender = NULL;
|
newsevent->address = sevent->address;
|
||||||
isc_task_send(disp->task, eventp);
|
newsevent->timestamp = sevent->timestamp;
|
||||||
|
newsevent->pktinfo = sevent->pktinfo;
|
||||||
|
newsevent->attributes = sevent->attributes;
|
||||||
|
|
||||||
|
isc_task_send(disp->task, (isc_event_t **)&newsevent);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
|
@@ -15,7 +15,7 @@
|
|||||||
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
* 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
|
#ifndef DNS_DISPATCH_H
|
||||||
#define DNS_DISPATCH_H 1
|
#define DNS_DISPATCH_H 1
|
||||||
@@ -408,15 +408,15 @@ dns_dispatch_changeattributes(dns_dispatch_t *disp,
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
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
|
* Inform the dispatcher of a socket receive. This is used for sockets
|
||||||
* shared between dispatchers and clients. If the dispatcher fails to send
|
* shared between dispatchers and clients. If the dispatcher fails to copy
|
||||||
* the event, it frees it.
|
* or send the event, nothing happens.
|
||||||
*
|
*
|
||||||
* Requires:
|
* Requires:
|
||||||
* disp is valid, and the attribute DNS_DISPATCHATTR_NOLISTEN is set.
|
* disp is valid, and the attribute DNS_DISPATCHATTR_NOLISTEN is set.
|
||||||
* eventp != NULL && *eventp != NULL
|
* event != NULL
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ISC_LANG_ENDDECLS
|
ISC_LANG_ENDDECLS
|
||||||
|
Reference in New Issue
Block a user