h2load: Reuse SSL/TLS session
This commit is contained in:
parent
ff87bf7584
commit
55075516c9
|
@ -244,7 +244,13 @@ Client::Client(Worker *worker, size_t req_todo)
|
||||||
request_timeout_watcher.data = this;
|
request_timeout_watcher.data = this;
|
||||||
}
|
}
|
||||||
|
|
||||||
Client::~Client() { disconnect(); }
|
Client::~Client() {
|
||||||
|
disconnect();
|
||||||
|
|
||||||
|
if (ssl) {
|
||||||
|
SSL_free(ssl);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int Client::do_read() { return readfn(*this); }
|
int Client::do_read() { return readfn(*this); }
|
||||||
int Client::do_write() { return writefn(*this); }
|
int Client::do_write() { return writefn(*this); }
|
||||||
|
@ -255,7 +261,9 @@ int Client::make_socket(addrinfo *addr) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (config.scheme == "https") {
|
if (config.scheme == "https") {
|
||||||
|
if (!ssl) {
|
||||||
ssl = SSL_new(worker->ssl_ctx);
|
ssl = SSL_new(worker->ssl_ctx);
|
||||||
|
}
|
||||||
|
|
||||||
auto config = worker->config;
|
auto config = worker->config;
|
||||||
|
|
||||||
|
@ -362,10 +370,12 @@ void Client::disconnect() {
|
||||||
if (ssl) {
|
if (ssl) {
|
||||||
SSL_set_shutdown(ssl, SSL_RECEIVED_SHUTDOWN);
|
SSL_set_shutdown(ssl, SSL_RECEIVED_SHUTDOWN);
|
||||||
ERR_clear_error();
|
ERR_clear_error();
|
||||||
SSL_shutdown(ssl);
|
|
||||||
|
if (SSL_shutdown(ssl) != 1) {
|
||||||
SSL_free(ssl);
|
SSL_free(ssl);
|
||||||
ssl = nullptr;
|
ssl = nullptr;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (fd != -1) {
|
if (fd != -1) {
|
||||||
shutdown(fd, SHUT_WR);
|
shutdown(fd, SHUT_WR);
|
||||||
close(fd);
|
close(fd);
|
||||||
|
|
Loading…
Reference in New Issue