add tip_client_report()
parent
7d70e7abec
commit
e01a38e4a7
45
src/main.c
45
src/main.c
|
@ -592,6 +592,31 @@ static int tip_client_run(struct tip_client *cli, int fd, const char *addr,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int tip_client_report(struct tip_client *cli, const struct timeval *tv,
|
||||
uint64_t data_len)
|
||||
{
|
||||
if (cli->state == TIP_CLIENT_DONE) {
|
||||
printf("OK.\n");
|
||||
syslog(LOG_INFO, "Done in %lu.%06lu seconds (%lu Mbytes/second). "
|
||||
"Direct from server: %u Redirected: %u\n",
|
||||
tv->tv_sec, tv->tv_usec,
|
||||
tv->tv_sec > 0 ? data_len / 1024000 / tv->tv_sec : data_len / 1024000,
|
||||
tip_client_stats.direct_from_server,
|
||||
tip_client_stats.redirects);
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
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,
|
||||
tv->tv_sec > 0 ? data_len / 1024000 / tv->tv_sec : data_len / 1024000,
|
||||
tip_client_stats.direct_from_server,
|
||||
tip_client_stats.redirects);
|
||||
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
struct timeval tv_start, tv_stop, tv;
|
||||
|
@ -648,25 +673,7 @@ int main(int argc, char *argv[])
|
|||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
if (_cli.state == TIP_CLIENT_DONE) {
|
||||
printf("OK.\n");
|
||||
syslog(LOG_INFO, "Done in %lu.%06lu seconds (%lu Mbytes/second). "
|
||||
"Direct from server: %u Redirected: %u\n",
|
||||
tv.tv_sec, tv.tv_usec,
|
||||
tv.tv_sec > 0 ? data_len / 1024000 / tv.tv_sec : data_len / 1024000,
|
||||
tip_client_stats.direct_from_server,
|
||||
tip_client_stats.redirects);
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
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,
|
||||
tv.tv_sec > 0 ? data_len / 1024000 / tv.tv_sec : data_len / 1024000,
|
||||
tip_client_stats.direct_from_server,
|
||||
tip_client_stats.redirects);
|
||||
return EXIT_FAILURE;
|
||||
return tip_client_report(&_cli, &tv, data_len);
|
||||
|
||||
err_bailout:
|
||||
if (_cli.fatal)
|
||||
|
|
Loading…
Reference in New Issue