mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-29 13:38:26 +00:00
kill persistent errors. Always retry the I/O now.
This commit is contained in:
parent
d2439ad5af
commit
1deaf52c98
@ -15,7 +15,7 @@
|
||||
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: socket.h,v 1.49 2000/08/01 01:30:47 tale Exp $ */
|
||||
/* $Id: socket.h,v 1.50 2000/09/07 01:59:56 explorer Exp $ */
|
||||
|
||||
#ifndef ISC_SOCKET_H
|
||||
#define ISC_SOCKET_H 1
|
||||
@ -115,9 +115,6 @@ struct isc_socket_connev {
|
||||
|
||||
/*
|
||||
* _ATTACHED: Internal use only.
|
||||
* _FATALERROR: The socket result code is "sticky" -- that is, any
|
||||
* further i/o activity of the same type (read or write)
|
||||
* will return the same code; retrying is pointless.
|
||||
* _TRUNC: Packet was truncated on receive.
|
||||
* _CTRUNC: Packet control information was truncated. This can
|
||||
* indicate that the packet is not complete, even though
|
||||
@ -127,7 +124,6 @@ struct isc_socket_connev {
|
||||
* _MULTICAST: The UDP packet was received via a multicast transmission.
|
||||
*/
|
||||
#define ISC_SOCKEVENTATTR_ATTACHED 0x80000000U /* internal */
|
||||
#define ISC_SOCKEVENTATTR_FATALERROR 0x40000000U /* sock is dead */
|
||||
#define ISC_SOCKEVENTATTR_TRUNC 0x00800000U /* public */
|
||||
#define ISC_SOCKEVENTATTR_CTRUNC 0x00400000U /* public */
|
||||
#define ISC_SOCKEVENTATTR_TIMESTAMP 0x00200000U /* public */
|
||||
|
@ -15,7 +15,7 @@
|
||||
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: socket.c,v 1.164 2000/09/06 22:55:33 explorer Exp $ */
|
||||
/* $Id: socket.c,v 1.165 2000/09/07 01:59:57 explorer Exp $ */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
@ -141,8 +141,6 @@ struct isc_socket {
|
||||
unsigned int references;
|
||||
int fd;
|
||||
int pf;
|
||||
isc_result_t recv_result;
|
||||
isc_result_t send_result;
|
||||
|
||||
ISC_LIST(isc_socketevent_t) send_list;
|
||||
ISC_LIST(isc_socketevent_t) recv_list;
|
||||
@ -834,8 +832,6 @@ doio_recv(isc_socket_t *sock, isc_socketevent_t *dev) {
|
||||
#define SOFT_OR_HARD(_system, _isc) \
|
||||
if (errno == _system) { \
|
||||
if (sock->connected) { \
|
||||
if (sock->type == isc_sockettype_tcp) \
|
||||
sock->recv_result = _isc; \
|
||||
send_recvdone_event(sock, &dev, _isc); \
|
||||
return (DOIO_HARD); \
|
||||
} \
|
||||
@ -843,7 +839,6 @@ doio_recv(isc_socket_t *sock, isc_socketevent_t *dev) {
|
||||
}
|
||||
#define ALWAYS_HARD(_system, _isc) \
|
||||
if (errno == _system) { \
|
||||
sock->recv_result = _isc; \
|
||||
send_recvdone_event(sock, &dev, _isc); \
|
||||
return (DOIO_HARD); \
|
||||
}
|
||||
@ -856,7 +851,6 @@ doio_recv(isc_socket_t *sock, isc_socketevent_t *dev) {
|
||||
#undef SOFT_OR_HARD
|
||||
#undef ALWAYS_HARD
|
||||
|
||||
sock->recv_result = ISC_R_UNEXPECTED;
|
||||
send_recvdone_event(sock, &dev, ISC_R_UNEXPECTED);
|
||||
return (DOIO_SUCCESS);
|
||||
}
|
||||
@ -866,10 +860,8 @@ doio_recv(isc_socket_t *sock, isc_socketevent_t *dev) {
|
||||
* UDP, zero length reads are perfectly valid, although
|
||||
* strange.
|
||||
*/
|
||||
if ((sock->type == isc_sockettype_tcp) && (cc == 0)) {
|
||||
sock->recv_result = ISC_R_EOF;
|
||||
if ((sock->type == isc_sockettype_tcp) && (cc == 0))
|
||||
return (DOIO_EOF);
|
||||
}
|
||||
|
||||
if (sock->type == isc_sockettype_udp)
|
||||
dev->address.length = msghdr.msg_namelen;
|
||||
@ -967,8 +959,6 @@ doio_send(isc_socket_t *sock, isc_socketevent_t *dev) {
|
||||
#define SOFT_OR_HARD(_system, _isc) \
|
||||
if (errno == _system) { \
|
||||
if (sock->connected) { \
|
||||
if (sock->type == isc_sockettype_tcp) \
|
||||
sock->send_result = _isc; \
|
||||
send_senddone_event(sock, &dev, _isc); \
|
||||
return (DOIO_HARD); \
|
||||
} \
|
||||
@ -976,18 +966,19 @@ doio_send(isc_socket_t *sock, isc_socketevent_t *dev) {
|
||||
}
|
||||
#define ALWAYS_HARD(_system, _isc) \
|
||||
if (errno == _system) { \
|
||||
if (sock->connected && sock->type == isc_sockettype_tcp) \
|
||||
sock->send_result = _isc; \
|
||||
send_senddone_event(sock, &dev, _isc); \
|
||||
return (DOIO_HARD); \
|
||||
}
|
||||
|
||||
SOFT_OR_HARD(ECONNREFUSED, ISC_R_CONNREFUSED);
|
||||
SOFT_OR_HARD(EACCES, ISC_R_NOPERM);
|
||||
SOFT_OR_HARD(EAFNOSUPPORT, ISC_R_ADDRNOTAVAIL);
|
||||
ALWAYS_HARD(ENETUNREACH, ISC_R_NETUNREACH);
|
||||
ALWAYS_HARD(EHOSTUNREACH, ISC_R_HOSTUNREACH);
|
||||
ALWAYS_HARD(ENOBUFS, ISC_R_NORESOURCES);
|
||||
ALWAYS_HARD(EADDRNOTAVAIL, ISC_R_ADDRNOTAVAIL);
|
||||
ALWAYS_HARD(EPERM, ISC_R_HOSTUNREACH);
|
||||
ALWAYS_HARD(EPIPE, ISC_R_NOTCONNECTED);
|
||||
|
||||
#undef SOFT_OR_HARD
|
||||
#undef ALWAYS_HARD
|
||||
@ -1005,8 +996,6 @@ doio_send(isc_socket_t *sock, isc_socketevent_t *dev) {
|
||||
UNEXPECTED_ERROR(__FILE__, __LINE__,
|
||||
"internal_send: %s: %s",
|
||||
addrbuf, strerror(errno));
|
||||
if (sock->connected && sock->type == isc_sockettype_tcp)
|
||||
sock->send_result = ISC_R_UNEXPECTED;
|
||||
send_senddone_event(sock, &dev, ISC_R_UNEXPECTED);
|
||||
return (DOIO_HARD);
|
||||
}
|
||||
@ -1126,9 +1115,6 @@ allocate_socket(isc_socketmgr_t *manager, isc_sockettype_t type,
|
||||
sock->connecting = 0;
|
||||
sock->bound = 0;
|
||||
|
||||
sock->recv_result = ISC_R_SUCCESS;
|
||||
sock->send_result = ISC_R_SUCCESS;
|
||||
|
||||
/*
|
||||
* initialize the lock
|
||||
*/
|
||||
@ -1514,9 +1500,6 @@ send_recvdone_event(isc_socket_t *sock, isc_socketevent_t **dev,
|
||||
if (ISC_LINK_LINKED(*dev, ev_link))
|
||||
ISC_LIST_DEQUEUE(sock->recv_list, *dev, ev_link);
|
||||
|
||||
if (sock->recv_result != ISC_R_SUCCESS)
|
||||
(*dev)->attributes |= ISC_SOCKEVENTATTR_FATALERROR;
|
||||
|
||||
if (((*dev)->attributes & ISC_SOCKEVENTATTR_ATTACHED)
|
||||
== ISC_SOCKEVENTATTR_ATTACHED)
|
||||
isc_task_sendanddetach(&task, (isc_event_t **)dev);
|
||||
@ -1544,9 +1527,6 @@ send_senddone_event(isc_socket_t *sock, isc_socketevent_t **dev,
|
||||
if (ISC_LINK_LINKED(*dev, ev_link))
|
||||
ISC_LIST_DEQUEUE(sock->send_list, *dev, ev_link);
|
||||
|
||||
if (sock->send_result != ISC_R_SUCCESS)
|
||||
(*dev)->attributes |= ISC_SOCKEVENTATTR_FATALERROR;
|
||||
|
||||
if (((*dev)->attributes & ISC_SOCKEVENTATTR_ATTACHED)
|
||||
== ISC_SOCKEVENTATTR_ATTACHED)
|
||||
isc_task_sendanddetach(&task, (isc_event_t **)dev);
|
||||
@ -1742,14 +1722,7 @@ internal_recv(isc_task_t *me, isc_event_t *ev) {
|
||||
* continue the loop.
|
||||
*/
|
||||
if (dev->ev_type == ISC_SOCKEVENT_RECVMARK) {
|
||||
send_recvdone_event(sock, &dev, sock->recv_result);
|
||||
goto next;
|
||||
}
|
||||
|
||||
if (sock->recv_result != ISC_R_SUCCESS) {
|
||||
socket_log(sock, NULL, IOEVENT,
|
||||
"STICKY RESULT: %d", sock->recv_result);
|
||||
send_recvdone_event(sock, &dev, sock->recv_result);
|
||||
send_recvdone_event(sock, &dev, ISC_R_SUCCESS);
|
||||
goto next;
|
||||
}
|
||||
|
||||
@ -1828,12 +1801,7 @@ internal_send(isc_task_t *me, isc_event_t *ev) {
|
||||
* continue the loop.
|
||||
*/
|
||||
if (dev->ev_type == ISC_SOCKEVENT_SENDMARK) {
|
||||
send_senddone_event(sock, &dev, sock->send_result);
|
||||
goto next;
|
||||
}
|
||||
|
||||
if (sock->send_result != ISC_R_SUCCESS) {
|
||||
send_senddone_event(sock, &dev, sock->send_result);
|
||||
send_senddone_event(sock, &dev, ISC_R_SUCCESS);
|
||||
goto next;
|
||||
}
|
||||
|
||||
@ -2274,12 +2242,6 @@ isc_socket_recvv(isc_socket_t *sock, isc_bufferlist_t *buflist,
|
||||
if (!was_empty)
|
||||
goto queue;
|
||||
|
||||
if (sock->recv_result != ISC_R_SUCCESS) {
|
||||
send_recvdone_event(sock, &dev, sock->recv_result);
|
||||
UNLOCK(&sock->lock);
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
switch (doio_recv(sock, dev)) {
|
||||
case DOIO_SOFT:
|
||||
goto queue;
|
||||
@ -2373,12 +2335,6 @@ isc_socket_recv(isc_socket_t *sock, isc_region_t *region, unsigned int minimum,
|
||||
if (!was_empty)
|
||||
goto queue;
|
||||
|
||||
if (sock->recv_result != ISC_R_SUCCESS) {
|
||||
send_recvdone_event(sock, &dev, sock->recv_result);
|
||||
UNLOCK(&sock->lock);
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
switch (doio_recv(sock, dev)) {
|
||||
case DOIO_SOFT:
|
||||
goto queue;
|
||||
@ -2483,12 +2439,6 @@ isc_socket_sendto(isc_socket_t *sock, isc_region_t *region,
|
||||
if (!was_empty)
|
||||
goto queue;
|
||||
|
||||
if (sock->send_result != ISC_R_SUCCESS) {
|
||||
send_senddone_event(sock, &dev, sock->send_result);
|
||||
UNLOCK(&sock->lock);
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
switch (doio_send(sock, dev)) {
|
||||
case DOIO_SOFT:
|
||||
goto queue;
|
||||
@ -2593,12 +2543,6 @@ isc_socket_sendtov(isc_socket_t *sock, isc_bufferlist_t *buflist,
|
||||
if (!was_empty)
|
||||
goto queue;
|
||||
|
||||
if (sock->send_result != ISC_R_SUCCESS) {
|
||||
send_senddone_event(sock, &dev, sock->send_result);
|
||||
UNLOCK(&sock->lock);
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
switch (doio_send(sock, dev)) {
|
||||
case DOIO_SOFT:
|
||||
goto queue;
|
||||
@ -3205,16 +3149,6 @@ isc_socket_recvmark(isc_socket_t *sock,
|
||||
dev->result = ISC_R_SUCCESS;
|
||||
dev->minimum = 0;
|
||||
|
||||
/*
|
||||
* If the queue is empty, simply return the last error we got on
|
||||
* this socket as the result code, and send off the done event.
|
||||
*/
|
||||
if (ISC_LIST_EMPTY(sock->recv_list)) {
|
||||
send_recvdone_event(sock, &dev, sock->recv_result);
|
||||
UNLOCK(&sock->lock);
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
/*
|
||||
* Bad luck. The queue wasn't empty. Insert this in the proper
|
||||
* place.
|
||||
@ -3260,16 +3194,6 @@ isc_socket_sendmark(isc_socket_t *sock,
|
||||
dev->result = ISC_R_SUCCESS;
|
||||
dev->minimum = 0;
|
||||
|
||||
/*
|
||||
* If the queue is empty, simply return the last error we got on
|
||||
* this socket as the result code, and send off the done event.
|
||||
*/
|
||||
if (ISC_LIST_EMPTY(sock->send_list)) {
|
||||
send_senddone_event(sock, &dev, sock->send_result);
|
||||
UNLOCK(&sock->lock);
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
/*
|
||||
* Bad luck. The queue wasn't empty. Insert this in the proper
|
||||
* place.
|
||||
|
Loading…
x
Reference in New Issue
Block a user