* SOFTWARE.
*/
-/* $Id: dispatch.c,v 1.57.2.2 2000/09/02 00:00:13 bwelling Exp $ */
+/* $Id: dispatch.c,v 1.57.2.3 2000/09/08 22:09:13 explorer Exp $ */
#include <config.h>
/*
* General flow:
*
- * If I/O result == CANCELED, free the buffer and notify everyone as
- * the various queues drain.
- *
- * If I/O is error (not canceled and not success) log it, free the buffer,
- * and restart.
+ * If I/O result == CANCELED, EOF, or error, free the buffer
+ * and notify everyone as the various queues drain.
*
* If query:
* if no listeners: free the buffer, restart.
tcpmsg->result = ISC_R_CANCELED;
}
- switch (tcpmsg->result) {
- case ISC_R_SUCCESS:
- break;
+ if (tcpmsg->result != ISC_R_SUCCESS) {
+ switch (tcpmsg->result) {
+ case ISC_R_CANCELED:
+ break;
+
+ case ISC_R_EOF:
+ dispatch_log(disp, LVL(90), "shutting down on EOF");
+ disp->shutdown_why = ISC_R_EOF;
+ disp->shutting_down = 1;
+ do_cancel(disp, NULL);
+ break;
- case ISC_R_EOF:
- dispatch_log(disp, LVL(90), "shutting down on EOF");
- disp->shutdown_why = ISC_R_EOF;
- disp->shutting_down = 1;
- do_cancel(disp, NULL);
- /* FALLTHROUGH */
+ default:
+ dispatch_log(disp, ISC_LOG_ERROR,
+ "shutting down due to TCP "
+ "receive error: %s",
+ isc_result_totext(tcpmsg->result));
+ disp->shutdown_why = ISC_R_EOF;
+ disp->shutting_down = 1;
+ do_cancel(disp, NULL);
+ break;
+ }
- case ISC_R_CANCELED:
/*
* The event is statically allocated in the tcpmsg
* structure, and destroy_disp() frees the tcpmsg, so we must
if (killit)
destroy_mgr(&mgr);
}
-
return;
-
- default:
- /*
- * otherwise, on strange error, log it and restart.
- * XXXMLG
- */
- goto restart;
}
dispatch_log(disp, LVL(90), "result %d, length == %d, addr = %p",