mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-09-04 00:25:29 +00:00
"hard" errors in accept() were handled really badly. They were logged
twice, and the socket object for the new socket was never destroyed, causing the server to hang on exit (if multithreaded) or dump core on exit (if singlethreaded). Now the only difference between "hard" and "soft" errors is that the latter are not logged.
This commit is contained in:
@@ -15,7 +15,7 @@
|
||||
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: socket.c,v 1.188 2001/02/06 23:04:02 gson Exp $ */
|
||||
/* $Id: socket.c,v 1.189 2001/02/06 23:43:01 gson Exp $ */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
@@ -1671,33 +1671,19 @@ internal_accept(isc_task_t *me, isc_event_t *ev) {
|
||||
fd = accept(sock->fd, &dev->newsocket->address.type.sa,
|
||||
(void *)&addrlen);
|
||||
if (fd < 0) {
|
||||
if (SOFT_ERROR(errno)) {
|
||||
select_poke(sock->manager, sock->fd,
|
||||
SELECT_POKE_ACCEPT);
|
||||
UNLOCK(&sock->lock);
|
||||
return;
|
||||
if (! SOFT_ERROR(errno)) {
|
||||
UNEXPECTED_ERROR(__FILE__, __LINE__,
|
||||
"internal_accept: accept() %s: %s",
|
||||
isc_msgcat_get(isc_msgcat,
|
||||
ISC_MSGSET_GENERAL,
|
||||
ISC_MSG_FAILED,
|
||||
"failed"),
|
||||
strerror(errno));
|
||||
}
|
||||
|
||||
/*
|
||||
* If some other error, ignore it as well and hope
|
||||
* for the best, but log it.
|
||||
*/
|
||||
if (isc_log_wouldlog(isc_lctx, TRACE_LEVEL))
|
||||
socket_log(sock, NULL, TRACE, isc_msgcat,
|
||||
ISC_MSGSET_SOCKET,
|
||||
ISC_MSG_ACCEPTRETURNED,
|
||||
"accept() returned %d/%s",
|
||||
errno, strerror(errno));
|
||||
|
||||
fd = -1;
|
||||
|
||||
UNEXPECTED_ERROR(__FILE__, __LINE__,
|
||||
"internal_accept: accept() %s: %s",
|
||||
isc_msgcat_get(isc_msgcat, ISC_MSGSET_GENERAL,
|
||||
ISC_MSG_FAILED, "failed"),
|
||||
strerror(errno));
|
||||
|
||||
result = ISC_R_UNEXPECTED;
|
||||
select_poke(sock->manager, sock->fd,
|
||||
SELECT_POKE_ACCEPT);
|
||||
UNLOCK(&sock->lock);
|
||||
return;
|
||||
} else {
|
||||
if (dev->newsocket->address.type.sa.sa_family != sock->pf) {
|
||||
UNEXPECTED_ERROR(__FILE__, __LINE__,
|
||||
@@ -1713,10 +1699,11 @@ internal_accept(isc_task_t *me, isc_event_t *ev) {
|
||||
UNLOCK(&sock->lock);
|
||||
return;
|
||||
}
|
||||
dev->newsocket->address.length = addrlen;
|
||||
dev->newsocket->pf = sock->pf;
|
||||
}
|
||||
|
||||
dev->newsocket->address.length = addrlen;
|
||||
dev->newsocket->pf = sock->pf;
|
||||
|
||||
/*
|
||||
* Pull off the done event.
|
||||
*/
|
||||
|
Reference in New Issue
Block a user