summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortiptorrent development team <tiptorrent@soleta.eu>2021-09-16 17:45:10 +0200
committertiptorrent development team <tiptorrent@soleta.eu>2021-09-29 15:48:38 +0200
commite46be236c79e6ba0c423d0482d41463bd8af299f (patch)
tree658ec12f2a588e12ea76ccd9e9e4bdb4117b3127
parent353c5d3660c309cb8df9392e6475023b30f5d4d8 (diff)
fix bogus error if clients closes connection unexpectly
Reports a bogus: unknown read state 5, critical internal error for 127.0.0.1:60610
-rw-r--r--src/core.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/core.c b/src/core.c
index c6d8963..e36b3fa 100644
--- a/src/core.c
+++ b/src/core.c
@@ -169,6 +169,16 @@ static void tip_client_read_cb(struct ev_loop *loop, struct ev_io *io, int event
ev_io_set(&cli->io, tip_client_socket(cli), EV_READ | EV_WRITE);
ev_io_start(loop, &cli->io);
break;
+ case TIP_CLIENT_PROCESSING_REQUEST_2:
+ case TIP_CLIENT_PROCESSING_REQUEST_3:
+ if (ret == 0) {
+ syslog(LOG_ERR, "client %s:%hu unexpectedly closes connection\n",
+ inet_ntoa(cli->addr.sin_addr), ntohs(cli->addr.sin_port));
+ goto shutdown;
+ }
+ syslog(LOG_ERR, "unexpected read from client %s:%hu while in write state\n",
+ inet_ntoa(cli->addr.sin_addr), ntohs(cli->addr.sin_port));
+ goto close;
case TIP_CLIENT_CLOSE_WAIT:
if (ret == 0) {
syslog(LOG_INFO, "client %s:%hu finished to download successfully\n",