mirror of
https://github.com/isc-projects/bind9.git
synced 2026-06-13 20:20:00 -04: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:
parent
8dab78b566
commit
9a3ee1570d
1 changed files with 16 additions and 29 deletions
|
|
@ -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.
|
||||
*/
|
||||
|
|
|
|||
Loading…
Reference in a new issue