summaryrefslogtreecommitdiffstats
path: root/src/main.c
diff options
context:
space:
mode:
authortiptorrent development team <tiptorrent@soleta.eu>2021-09-19 21:56:13 +0200
committertiptorrent development team <tiptorrent@soleta.eu>2021-09-19 21:56:13 +0200
commit97f7ab42ab70a7cfe3e3ac369c697b8239b85ed6 (patch)
tree7da0ae226f86777947430f36a282a50c2a2f810e /src/main.c
parentc8495d5a897f04ee8e6dd752d088f5d765cabc27 (diff)
display failure stats on syslog
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/main.c b/src/main.c
index 83ac1d8..599623b 100644
--- a/src/main.c
+++ b/src/main.c
@@ -437,9 +437,10 @@ int main(int argc, char *argv[])
data_len += _cli.data_len;
}
+ gettimeofday(&tv_stop, NULL);
+ timersub(&tv_stop, &tv_start, &tv);
+
if (_cli.state == TIP_CLIENT_DONE) {
- gettimeofday(&tv_stop, NULL);
- timersub(&tv_stop, &tv_start, &tv);
printf("OK.\n");
syslog(LOG_INFO, "Done in %lu.%06lu seconds (%lu Mbytes/second). "
"Direct from server: %u Redirected: %u\n",
@@ -451,5 +452,11 @@ int main(int argc, char *argv[])
}
printf("Failure, see syslog for details.\n");
+ syslog(LOG_INFO, "Failure after %lu.%06lu seconds (%lu Mbytes/second). "
+ "Direct from server: %u Redirected: %u\n",
+ tv.tv_sec, tv.tv_usec,
+ data_len / 1024000 / tv.tv_sec,
+ tip_client_stats.direct_from_server,
+ tip_client_stats.redirects);
return EXIT_FAILURE;
}