1114. [port] Ignore more accept() errors. [RT #2021]

This commit is contained in:
Andreas Gustafsson
2001-11-08 20:24:25 +00:00
parent 9eec883bf8
commit ea01b618d9
2 changed files with 36 additions and 15 deletions

View File

@@ -1,3 +1,5 @@
1114. [port] Ignore more accept() errors. [RT #2021]
1113. [bug] allow-update/allow-update-forwarding did not work
when specified in a view. [RT #2014]

View File

@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: socket.c,v 1.211 2001/10/31 01:24:58 gson Exp $ */
/* $Id: socket.c,v 1.212 2001/11/08 20:24:25 gson Exp $ */
#include <config.h>
@@ -1710,28 +1710,47 @@ internal_accept(isc_task_t *me, isc_event_t *ev) {
* EAGAIN or EINTR, simply poke the watcher to watch this socket
* again. Also ignore ECONNRESET, which has been reported to
* be spuriously returned on Linux 2.2.19 although it is not
* a documented error for accept().
* a documented error for accept(). ECONNABORTED has been
* reported for Solaris 8. The rest are thrown in not because
* we have seen them but because they are ignored by other
* deamons such as BIND 8 and Apache.
*/
addrlen = sizeof dev->newsocket->address.type;
memset(&dev->newsocket->address.type.sa, 0, addrlen);
fd = accept(sock->fd, &dev->newsocket->address.type.sa,
(void *)&addrlen);
if (fd < 0) {
if (SOFT_ERROR(errno) || errno == ECONNRESET) {
if (SOFT_ERROR(errno))
goto soft_error;
} else {
isc__strerror(errno, strbuf, sizeof(strbuf));
UNEXPECTED_ERROR(__FILE__, __LINE__,
"internal_accept: accept() %s: %s",
isc_msgcat_get(isc_msgcat,
ISC_MSGSET_GENERAL,
ISC_MSG_FAILED,
"failed"),
strbuf);
fd = -1;
result = ISC_R_UNEXPECTED;
switch (errno) {
case ECONNRESET:
case ECONNABORTED:
case EHOSTUNREACH:
case EHOSTDOWN:
case ENETUNREACH:
case ENETDOWN:
case ECONNREFUSED:
#ifdef EPROTO
case EPROTO:
#endif
#ifdef ENONET
case ENONET:
#endif
goto soft_error;
default:
break;
}
isc__strerror(errno, strbuf, sizeof(strbuf));
UNEXPECTED_ERROR(__FILE__, __LINE__,
"internal_accept: accept() %s: %s",
isc_msgcat_get(isc_msgcat,
ISC_MSGSET_GENERAL,
ISC_MSG_FAILED,
"failed"),
strbuf);
fd = -1;
result = ISC_R_UNEXPECTED;
} else {
if (addrlen == 0) {
UNEXPECTED_ERROR(__FILE__, __LINE__,