From db4f4980c5ee29a9fc74b3fe745ed74f58173a6f Mon Sep 17 00:00:00 2001 From: "Jose M. Guisado" Date: Wed, 28 Sep 2022 16:09:32 +0200 Subject: keep client retries when tip_client_request_file fails Keep client retry count when something goes wrong requesting file size (HEAD request). Fixes a bug where tiptorrent-client keeps sending HEAD requests indifinitely when something goes wrong at this stage. --- src/main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main.c b/src/main.c index 298112d..a9fba30 100644 --- a/src/main.c +++ b/src/main.c @@ -552,6 +552,7 @@ int main(int argc, char *argv[]) return EXIT_FAILURE; } addr = argv[1]; + filename = argv[2]; openlog("tiptorrent-client", LOG_PID, LOG_DAEMON); @@ -562,8 +563,7 @@ int main(int argc, char *argv[]) gettimeofday(&tv_start, NULL); do { - filename = argv[2]; - memset(&_cli, 0, sizeof(_cli)); + tip_client_reset_state(&_cli, -1, 0); _cli.state = TIP_CLIENT_HEAD_HEADER; ret = tip_client_request_file(&_cli, addr, filename); } while (ret > 0); -- cgit v1.2.3-18-g5258