Commit f07fe5a1 authored by Mark Andrews's avatar Mark Andrews
Browse files

2067. [bug] 'rndc' could close the socket too early triggering

                        a INSIST under Windows. [RT #16317]
parent cdd28dc0
2067. [bug] 'rndc' could close the socket too early triggering
a INSIST under Windows. [RT #16317]
2066. [placeholder] rt16300
2065. [bug] libbind: probe for HPUX prototypes for
......
......@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: rndc.c,v 1.112 2006/07/20 03:41:57 marka Exp $ */
/* $Id: rndc.c,v 1.113 2006/08/04 02:55:37 marka Exp $ */
/*! \file */
......@@ -176,6 +176,11 @@ rndc_senddone(isc_task_t *task, isc_event_t *event) {
if (sevent->result != ISC_R_SUCCESS)
fatal("send failed: %s", isc_result_totext(sevent->result));
isc_event_free(&event);
if (sends == 0 && recvs == 0) {
isc_socket_detach(&sock);
isc_task_shutdown(task);
RUNTIME_CHECK(isc_app_shutdown() == ISC_R_SUCCESS);
}
}
static void
......@@ -228,9 +233,11 @@ rndc_recvdone(isc_task_t *task, isc_event_t *event) {
isc_event_free(&event);
isccc_sexpr_free(&response);
isc_socket_detach(&sock);
isc_task_shutdown(task);
RUNTIME_CHECK(isc_app_shutdown() == ISC_R_SUCCESS);
if (sends == 0 && recvs == 0) {
isc_socket_detach(&sock);
isc_task_shutdown(task);
RUNTIME_CHECK(isc_app_shutdown() == ISC_R_SUCCESS);
}
}
static void
......
......@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: socket.c,v 1.44 2006/06/06 00:53:36 marka Exp $ */
/* $Id: socket.c,v 1.45 2006/08/04 02:55:37 marka Exp $ */
/* This code has been rewritten to take advantage of Windows Sockets
* I/O Completion Ports and Events. I/O Completion Ports is ONLY
......@@ -1711,14 +1711,15 @@ destroy_socket(isc_socket_t **sockp) {
socket_log(sock, NULL, CREATION, isc_msgcat, ISC_MSGSET_SOCKET,
ISC_MSG_DESTROYING, "destroying socket %d", sock->fd);
LOCK(&manager->lock);
LOCK(&sock->lock);
INSIST(ISC_LIST_EMPTY(sock->accept_list));
INSIST(ISC_LIST_EMPTY(sock->recv_list));
INSIST(ISC_LIST_EMPTY(sock->send_list));
INSIST(sock->connect_ev == NULL);
LOCK(&manager->lock);
LOCK(&sock->lock);
socket_close(sock);
if (sock->pending_recv != 0 || sock->pending_send != 0 ||
sock->pending_close != 0) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment