diff options
author | Tom Smeding <tom.smeding@gmail.com> | 2020-07-05 14:57:13 +0200 |
---|---|---|
committer | Tom Smeding <tom.smeding@gmail.com> | 2020-07-05 14:57:13 +0200 |
commit | b2cae6770ba63fedb6059003e9aa0b113060807f (patch) | |
tree | 7c6f771bd69cb63b55e172d82975af70b13e2f46 | |
parent | d43184f306eb1406f6cad5348d0138f6bec276dd (diff) |
server: Don't crash on ECONNRESET from client
-rw-r--r-- | main.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -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){ |