Skip to content
Snippets Groups Projects
Commit 5cbd5cbe authored by Guillaume Roguez's avatar Guillaume Roguez Committed by gerrit2
Browse files

sip-tls: do not shutdown tls session at pjsip shutdown

It could be counter-intuitive but it's a bad idea to
shutdown the tls session at shutdown pjsip event.
This event is due to the call of pjsip_transport_shutdown()
function. Its documentation indicates that objects
having a session lock on the transport can continue to send
and receive from the transport but new lock can't be obtained.
So, we need to continue tls IO after this event.

This also gives a chance to some msg to be sent, like BYE request.

Change-Id: Ifa82469ec416652f26c240a42c55a284e1887040
Tuleap: #64
parent 82cf1069
No related branches found
No related tags found
No related merge requests found
......@@ -200,19 +200,10 @@ SipsIceTransport::SipsIceTransport(pjsip_endpoint* endpt,
};
base.do_shutdown = [](pjsip_transport *transport) -> pj_status_t {
auto& this_ = reinterpret_cast<TransportData*>(transport)->self;
RING_DBG("SipsIceTransport@%p: shutdown", this_);
{
// Flush pending state changes and rx packet before shutdown
// or pjsip callbacks will crash
std::lock_guard<std::mutex> lk{this_->stateChangeEventsMutex_};
this_->stateChangeEvents_.clear();
std::lock_guard<std::mutex> lk2(this_->rxMtx_);
this_->rxPending_.clear();
this_->tls_->shutdown();
}
RING_DBG("SipsIceTransport@%p {tr=%p {rc=%ld}}: shutdown", this_,
transport, pj_atomic_get(transport->ref_cnt));
// Nothing to do here, tls session is not shutdown as some messages could be pending
// and application can continue to do IO (if they already own the transport)
return PJ_SUCCESS;
};
base.destroy = [](pjsip_transport *transport) -> pj_status_t {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment