Add ASYNC_JOB pools
It is expensive to create the ASYNC_JOB objects due to the "makecontext"
call. This change adds support for pools of ASYNC_JOB objects so that we
don't have to create a new ASYNC_JOB every time we want to use one.
Reviewed-by: Rich Salz <rsalz@openssl.org>
diff --git a/apps/s_server.c b/apps/s_server.c
index 548eacb..6fb8f67 100644
--- a/apps/s_server.c
+++ b/apps/s_server.c
@@ -143,6 +143,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <openssl/async.h>
#include <openssl/e_os2.h>
@@ -1657,8 +1658,10 @@
else
SSL_CTX_sess_set_cache_size(ctx, 128);
- if (async)
+ if (async) {
SSL_CTX_set_mode(ctx, SSL_MODE_ASYNC);
+ ASYNC_init_pool(0, 0, 0);
+ }
#ifndef OPENSSL_NO_SRTP
if (srtp_profiles != NULL) {
@@ -1970,6 +1973,9 @@
bio_s_out = NULL;
BIO_free(bio_s_msg);
bio_s_msg = NULL;
+ if (async) {
+ ASYNC_free_pool();
+ }
return (ret);
}