Don't modify s->read_ahead in SSL_clear, which is called from accept/connect functions; those should not change the read_ahead setting of the SSL structure.
diff --git a/ssl/ssl_lib.c b/ssl/ssl_lib.c index 635b250..d77d340 100644 --- a/ssl/ssl_lib.c +++ b/ssl/ssl_lib.c
@@ -119,7 +119,9 @@ s->client_version=s->version; s->rwstate=SSL_NOTHING; s->rstate=SSL_ST_READ_HEADER; +#if 0 s->read_ahead=s->ctx->read_ahead; +#endif if (s->init_buf != NULL) {