aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--main.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/main.c b/main.c
index b925cd1..145a614 100644
--- a/main.c
+++ b/main.c
@@ -81,12 +81,12 @@ static bool client_socket_callback(int fd){
ssize_t ret;
do ret=read(fd,data->buffer+data->buflen,data->bufsz-data->buflen);
while(ret<0&&errno==EINTR);
- if(ret<0)die_perror("read");
- if(ret==0){
+ if(ret==0||(ret<0&&(errno==ECONNRESET||errno==ETIMEDOUT))){
delete_conn_data(fd);
close(fd);
return true;
}
+ if(ret<0)die_perror("read");
data->buflen+=ret;
while(true){