Implement peer review feedback

This commit is contained in:
kaleb-himes
2022-06-03 11:06:46 -06:00
parent 3bcdef1972
commit 96d5814bfe

View File

@ -544,8 +544,7 @@ static int ClientBenchmarkConnections(WOLFSSL_CTX* ctx, char* host, word16 port,
int version, int earlyData)
{
/* time passed in number of connects give average */
int times = benchmark;
double skip = (double) times * 0.1;
int times = benchmark, skip = (int)((double)times * 0.1);
int loops = resumeSession ? 2 : 1;
int i = 0, err, ret;
#ifndef NO_SESSION_CACHE
@ -570,16 +569,13 @@ static int ClientBenchmarkConnections(WOLFSSL_CTX* ctx, char* host, word16 port,
#ifndef NO_SESSION_CACHE
int benchResume = resumeSession && loops == 0;
#endif
double start = current_time(1), avg, check;
double start = current_time(1), avg;
for (i = 0; i < times; i++) {
SOCKET_T sockfd;
WOLFSSL* ssl;
/* cannot compare doubles with == or != instead subtract and if
* result is 0 then they were equal */
check = (double)i - skip;
if (check > -1.0 && check < 1.0)
if (i == skip)
start = current_time(1);
ssl = wolfSSL_new(ctx);