Move tally mark printing out of the main benchmark loop; ok tb@
authorcheloha <cheloha@openbsd.org>
Mon, 17 Sep 2018 15:37:35 +0000 (15:37 +0000)
committercheloha <cheloha@openbsd.org>
Mon, 17 Sep 2018 15:37:35 +0000 (15:37 +0000)
usr.bin/openssl/s_time.c

index 793e50e..1506ca3 100644 (file)
@@ -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;