From 11c2e0339c0ca622438065977ff8c2711537f771 Mon Sep 17 00:00:00 2001 From: cheloha Date: Mon, 17 Sep 2018 15:37:35 +0000 Subject: [PATCH] Move tally mark printing out of the main benchmark loop; ok tb@ --- usr.bin/openssl/s_time.c | 35 +++++++++++++++++++++-------------- 1 file changed, 21 insertions(+), 14 deletions(-) diff --git a/usr.bin/openssl/s_time.c b/usr.bin/openssl/s_time.c index 793e50e4be7..1506ca356ac 100644 --- a/usr.bin/openssl/s_time.c +++ b/usr.bin/openssl/s_time.c @@ -1,4 +1,4 @@ -/* $OpenBSD: s_time.c,v 1.31 2018/08/28 14:30:48 cheloha Exp $ */ +/* $OpenBSD: s_time.c,v 1.32 2018/09/17 15:37:35 cheloha Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -92,6 +92,7 @@ extern int verify_depth; static void s_time_usage(void); static int run_test(SSL *); static int benchmark(int); +static void print_tally_mark(SSL *); static SSL_CTX *tm_ctx = NULL; static const SSL_METHOD *s_time_meth = NULL; @@ -393,6 +394,24 @@ run_test(SSL *scon) return 1; } +static void +print_tally_mark(SSL *scon) +{ + int ver; + + if (SSL_session_reused(scon)) + ver = 'r'; + else { + ver = SSL_version(scon); + if (ver == TLS1_VERSION) + ver = 't'; + else + ver = '*'; + } + fputc(ver, stdout); + fflush(stdout); +} + static int benchmark(int reuse_session) { @@ -400,7 +419,6 @@ benchmark(int reuse_session) int nConn = 0; SSL *scon = NULL; int ret = 1; - int ver; if (reuse_session) { /* Get an SSL object so we can reuse the session id */ @@ -429,18 +447,7 @@ benchmark(int reuse_session) if (!run_test(scon)) goto end; nConn += 1; - if (SSL_session_reused(scon)) - ver = 'r'; - else { - ver = SSL_version(scon); - if (ver == TLS1_VERSION) - ver = 't'; - else - ver = '*'; - } - fputc(ver, stdout); - fflush(stdout); - + print_tally_mark(scon); if (!reuse_session) { SSL_free(scon); scon = NULL; -- 2.20.1