From e46be236c79e6ba0c423d0482d41463bd8af299f Mon Sep 17 00:00:00 2001 From: tiptorrent development team Date: Thu, 16 Sep 2021 17:45:10 +0200 Subject: fix bogus error if clients closes connection unexpectly Reports a bogus: unknown read state 5, critical internal error for 127.0.0.1:60610 --- src/core.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/core.c') 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", -- cgit v1.2.3-18-g5258