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