From 94c45d5d36ddb236c0d988ff6d8b2e2d9b23c466 Mon Sep 17 00:00:00 2001 From: tiptorrent development team Date: Tue, 14 Sep 2021 14:37:19 +0200 Subject: 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 --- src/core.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/core.c b/src/core.c index fa1bf73..6c04891 100644 --- a/src/core.c +++ b/src/core.c @@ -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); -- cgit v1.2.3-18-g5258