fix bogus error if clients closes connection unexpectly

Reports a bogus:

unknown read state 5, critical internal error for 127.0.0.1:60610
master
tiptorrent development team 2021-09-16 17:45:10 +02:00
parent 353c5d3660
commit e46be236c7
1 changed files with 10 additions and 0 deletions

View File

@ -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",