Skip to content

Commit

Permalink
Preserve cert name through ssl vc migration (apache#6977)
Browse files Browse the repository at this point in the history
  • Loading branch information
shinrich committed Jul 13, 2020
1 parent cd7d9ff commit cf4631c
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions iocore/net/UnixNetVConnection.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1394,8 +1394,9 @@ UnixNetVConnection::migrateToCurrentThread(Continuation *cont, EThread *t)
hold_con.move(this->con);
SSLNetVConnection *sslvc = dynamic_cast<SSLNetVConnection *>(this);

SSL *save_ssl = (sslvc) ? sslvc->ssl : nullptr;
if (save_ssl) {
SSL *save_ssl = nullptr;
if (sslvc) {
save_ssl = sslvc->ssl;
SSLNetVCDetach(sslvc->ssl);
sslvc->ssl = nullptr;
}
Expand All @@ -1409,7 +1410,7 @@ UnixNetVConnection::migrateToCurrentThread(Continuation *cont, EThread *t)
// Create new VC:
UnixNetVConnection *netvc = nullptr;
if (save_ssl) {
SSLNetVConnection *sslvc = static_cast<SSLNetVConnection *>(sslNetProcessor.allocate_vc(t));
sslvc = static_cast<SSLNetVConnection *>(sslNetProcessor.allocate_vc(t));
if (sslvc->populate(hold_con, cont, save_ssl) != EVENT_DONE) {
sslvc->do_io_close();
sslvc = nullptr;
Expand All @@ -1427,6 +1428,9 @@ UnixNetVConnection::migrateToCurrentThread(Continuation *cont, EThread *t)
netvc->set_context(get_context());
}
}
if (netvc) {
netvc->options = this->options;
}
// Do not mark this closed until the end so it does not get freed by the other thread too soon
this->do_io_close();
return netvc;
Expand Down

0 comments on commit cf4631c

Please sign in to comment.