mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2026-07-09 18:50:59 +02:00
Address review: harden dtls_bench time source and -z usage
Fail loudly if clock_gettime() ever fails instead of computing throughput from uninitialized stack, and warn when -z is combined with -s since the sink-send only applies to the client.
This commit is contained in:
@@ -116,7 +116,10 @@ typedef struct cfg {
|
||||
static double now_sec(void)
|
||||
{
|
||||
struct timespec ts;
|
||||
(void)clock_gettime(CLOCK_MONOTONIC, &ts);
|
||||
if (clock_gettime(CLOCK_MONOTONIC, &ts) != 0) {
|
||||
perror("clock_gettime");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
return (double)ts.tv_sec + (double)ts.tv_nsec / 1e9;
|
||||
}
|
||||
|
||||
@@ -240,6 +243,11 @@ static int parse_args(int argc, char** argv, cfg_t* c)
|
||||
fprintf(stderr, "MTU must be between 64 and 16384\n");
|
||||
return -1;
|
||||
}
|
||||
if (c->isServer && c->sinkSend) {
|
||||
fprintf(stderr, "warning: -z only applies to the client (the send "
|
||||
"side); ignoring it in server mode\n");
|
||||
c->sinkSend = 0;
|
||||
}
|
||||
if (c->recordSz < 1) {
|
||||
fprintf(stderr, "record size must be > 0\n");
|
||||
return -1;
|
||||
|
||||
Reference in New Issue
Block a user