Commit a2317af5 authored by Tristan Matthews's avatar Tristan Matthews

* #11499: daemon: merge terminate and finish methods

parent e594e907
......@@ -131,24 +131,20 @@ void ManagerImpl::run()
void ManagerImpl::finish()
{
if (!finished_) {
finished_ = true;
// Unset signal handlers
signal(SIGHUP, SIG_DFL);
signal(SIGINT, SIG_DFL);
signal(SIGTERM, SIG_DFL);
terminate();
dbus_.exit();
}
}
if (finished_)
return;
finished_ = true;
// Unset signal handlers
signal(SIGHUP, SIG_DFL);
signal(SIGINT, SIG_DFL);
signal(SIGTERM, SIG_DFL);
void ManagerImpl::terminate()
{
std::vector<std::string> callList(getCallList());
DEBUG("Hangup %zu remaining call", callList.size());
DEBUG("Hangup %zu remaining call(s)", callList.size());
for (std::vector<std::string>::iterator iter = callList.begin();
iter != callList.end(); ++iter)
iter != callList.end(); ++iter)
hangupCall(*iter);
saveConfig();
......@@ -160,10 +156,14 @@ void ManagerImpl::terminate()
// the SIPVoIPLink, the link still needs the accounts for pjsip cleanup
unloadAccountMap();
ost::MutexLock lock(audioLayerMutex_);
{
ost::MutexLock lock(audioLayerMutex_);
delete audiodriver_;
audiodriver_ = NULL;
delete audiodriver_;
audiodriver_ = NULL;
}
dbus_.exit();
}
bool ManagerImpl::isCurrentCall(const std::string& callId) const
......
......@@ -140,11 +140,6 @@ class ManagerImpl {
*/
void run();
/**
* Terminate all thread (sound, link) and unload AccountMap
*/
void terminate();
/*
* Terminate all threads and exit DBus loop
*/
......
......@@ -143,8 +143,8 @@ int main(int argc, char* argv[])
// Run the tests.
bool wasSuccessful = runner.run();
printf("=== Test suite terminate ===\n");
Manager::instance().terminate();
printf("=== Test suite ending ===\n");
Manager::instance().finish();
restore();
......
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