summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authortiptorrent development team <tiptorrent@soleta.eu>2021-09-29 17:46:11 +0200
committertiptorrent development team <tiptorrent@soleta.eu>2021-09-29 17:46:47 +0200
commit48da60d88330e806469010423b6aab038e56b52b (patch)
tree193b679e4d06e286fd292210d0642baff1d7a5d1 /src
parent73d546b23ad717c93212ee091a8d118ab34d3fda (diff)
display progress message every 30 seconds
to avoid bloating the logs
Diffstat (limited to 'src')
-rw-r--r--src/main.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/main.c b/src/main.c
index 8e8819f..fef2447 100644
--- a/src/main.c
+++ b/src/main.c
@@ -100,13 +100,16 @@ static void tip_client_error(struct tip_client *cli)
tip_client_close(cli);
}
+/* display progress message every 30 seconds. */
+#define TIP_CLIENT_PROGRESS 30
+
static void tip_client_progress(struct tip_client *cli, bool now)
{
struct timeval tv_cur, tv;
gettimeofday(&tv_cur, NULL);
timersub(&tv_cur, &cli->tv_last, &tv);
- if (now || tv.tv_sec >= 1) {
+ if (now || tv.tv_sec >= TIP_CLIENT_PROGRESS) {
timersub(&tv_cur, &cli->tv_start, &tv);
printf("%3lu%% (%lu Mbytes/second) %s from %s:9999\n",
cli->content_len > 0 ? 100 * cli->data_len / cli->content_len : 0,