improve logging

Report "client %s:%hu starts download for %s" when the file transfer
really starts.

Replace log when redirection after pending state is not available
master
tiptorrent development team 2021-09-14 14:37:19 +02:00
parent a23722910e
commit 94c45d5d36
1 changed files with 11 additions and 11 deletions

View File

@ -165,15 +165,6 @@ static void tip_client_read_cb(struct ev_loop *loop, struct ev_io *io, int event
ntohs(cli->addr.sin_port));
goto close;
}
if (cli->method == TIP_METHOD_GET) {
syslog(LOG_INFO, "client %s:%hu starts download for %s\n",
inet_ntoa(cli->addr.sin_addr),
ntohs(cli->addr.sin_port), cli->uri);
} else {
syslog(LOG_INFO, "client %s:%hu checks if %s exists\n",
inet_ntoa(cli->addr.sin_addr),
ntohs(cli->addr.sin_port), cli->uri);
}
ev_io_stop(loop, &cli->io);
ev_io_set(&cli->io, tip_client_socket(cli), EV_READ | EV_WRITE);
ev_io_start(loop, &cli->io);
@ -279,6 +270,15 @@ static void tip_client_write_cb(struct ev_loop *loop, struct ev_io *io, int even
ntohs(cli->addr.sin_port));
goto close;
}
if (cli->method == TIP_METHOD_GET) {
syslog(LOG_INFO, "client %s:%hu starts download for %s\n",
inet_ntoa(cli->addr.sin_addr),
ntohs(cli->addr.sin_port), cli->uri);
} else {
syslog(LOG_INFO, "client %s:%hu checks if %s exists\n",
inet_ntoa(cli->addr.sin_addr),
ntohs(cli->addr.sin_port), cli->uri);
}
break;
case TIP_CLIENT_PROCESSING_REQUEST_3:
ret = tip_client_state_process_payload_bulk(cli);
@ -352,8 +352,8 @@ static void tip_client_activate_pending(void)
continue;
if (!tip_client_redirect(cli)) {
syslog(LOG_INFO, "sending %s to client %s:%hu",
cli->uri, inet_ntoa(cli->addr.sin_addr),
syslog(LOG_INFO, "no client redirections are available for client %s:%hu after resuming from pending state",
inet_ntoa(cli->addr.sin_addr),
htons(cli->addr.sin_port));
}
ev_io_set(&cli->io, tip_client_socket(cli), EV_READ | EV_WRITE);