Browse Source

Handle ETIMEDOUT as connection close

personal/stbuehler/wip
Stefan Bühler 12 years ago
parent
commit
3c2cef5f0d
  1. 1
      src/main/network.c
  2. 4
      src/main/network_sendfile.c
  3. 1
      src/main/network_write.c
  4. 1
      src/main/network_writev.c

1
src/main/network.c

@ -100,6 +100,7 @@ liNetworkStatus li_network_read(liVRequest *vr, int fd, liChunkQueue *cq) {
#endif
return len ? LI_NETWORK_STATUS_SUCCESS : LI_NETWORK_STATUS_WAIT_FOR_EVENT;
case ECONNRESET:
case ETIMEDOUT:
return LI_NETWORK_STATUS_CONNECTION_CLOSE;
default:
VR_ERROR(vr, "oops, read from fd=%d failed: %s", fd, g_strerror(errno) );

4
src/main/network_sendfile.c

@ -28,6 +28,7 @@ static network_sendfile_result lighty_sendfile(liVRequest *vr, int fd, int filef
return NSR_WAIT_FOR_EVENT;
case ECONNRESET:
case EPIPE:
case ETIMEDOUT:
return NSR_CLOSE;
case EINTR:
break; /* try again */
@ -59,6 +60,7 @@ static network_sendfile_result lighty_sendfile(liVRequest *vr, int fd, int filef
return NSR_WAIT_FOR_EVENT;
case ENOTCONN:
case EPIPE:
case ETIMEDOUT:
return NSR_CLOSE;
case EINTR:
if (r) {
@ -95,6 +97,7 @@ static network_sendfile_result lighty_sendfile(liVRequest *vr, int fd, int filef
case EAGAIN:
return NSR_WAIT_FOR_EVENT;
case EPIPE:
case ETIMEDOUT:
return NSR_CLOSE;
case EINTR:
break; /* try again */
@ -125,6 +128,7 @@ static network_sendfile_result lighty_sendfile(liVRequest *vr, int fd, int filef
return NSR_WAIT_FOR_EVENT;
case ENOTCONN:
case EPIPE:
case ETIMEDOUT:
return NSR_CLOSE;
case EINTR:
if (bytes) {

1
src/main/network_write.c

@ -32,6 +32,7 @@ liNetworkStatus li_network_backend_write(liVRequest *vr, int fd, liChunkQueue *c
return did_write_something ? LI_NETWORK_STATUS_SUCCESS : LI_NETWORK_STATUS_WAIT_FOR_EVENT;
case ECONNRESET:
case EPIPE:
case ETIMEDOUT:
return LI_NETWORK_STATUS_CONNECTION_CLOSE;
default:
VR_ERROR(vr, "oops, write to fd=%d failed: %s", fd, g_strerror(errno));

1
src/main/network_writev.c

@ -77,6 +77,7 @@ liNetworkStatus li_network_backend_writev(liVRequest *vr, int fd, liChunkQueue *
goto cleanup;
case ECONNRESET:
case EPIPE:
case ETIMEDOUT:
res = LI_NETWORK_STATUS_CONNECTION_CLOSE;
goto cleanup;
case EINTR:

Loading…
Cancel
Save