Commit c4a7918c authored by Sébastien Blin's avatar Sébastien Blin

sipvoiplink: fix creation and shutdown

Change-Id: If1ff8a0213b9687b0899b40d17feb56e491b35ca
parent 0a37f251
......@@ -744,6 +744,8 @@ Manager::init(const std::string &config_file)
setDhtLogLevel();
// Manager can restart without being recreated (Unit tests)
// So only create the SipLink once
pimpl_->sipLink_ = std::make_unique<SIPVoIPLink>();
check_rename(fileutils::get_cache_dir(PACKAGE_OLD), fileutils::get_cache_dir());
......@@ -757,7 +759,7 @@ Manager::init(const std::string &config_file)
bool no_errors = true;
// manager can restart without being recreated (android)
// manager can restart without being recreated (Unit tests)
pimpl_->finished_ = false;
try {
......@@ -850,6 +852,10 @@ Manager::finish() noexcept
// Also, it must be called before pj_shutdown to avoid any problem
pimpl_->ice_tf_.reset();
// NOTE: sipLink_->shutdown() is needed because this will perform
// sipTransportBroker->shutdown(); which will call Manager::instance().sipVoIPLink()
// so the pointer MUST NOT be resetted at this point
pimpl_->sipLink_->shutdown();
pimpl_->sipLink_.reset();
pj_shutdown();
......
......@@ -627,9 +627,12 @@ SIPVoIPLink::SIPVoIPLink() : pool_(nullptr, pj_pool_release)
JAMI_DBG("SIPVoIPLink@%p", this);
}
SIPVoIPLink::~SIPVoIPLink()
SIPVoIPLink::~SIPVoIPLink() {}
void
SIPVoIPLink::shutdown()
{
JAMI_DBG("~SIPVoIPLink@%p", this);
JAMI_DBG("Shutdown SIPVoIPLink@%p...", this);
// Remaining calls should not happen as possible upper callbacks
// may be called and another instance of SIPVoIPLink can be re-created!
......@@ -647,7 +650,7 @@ SIPVoIPLink::~SIPVoIPLink()
pool_.reset();
pj_caching_pool_destroy(&cp_);
JAMI_DBG("destroying SIPVoIPLink@%p", this);
JAMI_DBG("SIPVoIPLink@%p is shutdown", this);
}
std::shared_ptr<SIPAccountBase>
......
......@@ -68,6 +68,11 @@ class SIPVoIPLink {
SIPVoIPLink();
~SIPVoIPLink();
/**
* Destroy structures
*/
void shutdown();
/**
* Event listener. Each event send by the call manager is received and handled from here
*/
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment