[ekiga/v4_0] Made sure the STUN detector code doesn't crash if we quit-at-startup
- From: Eugen Dedu <ededu src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [ekiga/v4_0] Made sure the STUN detector code doesn't crash if we quit-at-startup
- Date: Mon, 18 Feb 2013 21:31:47 +0000 (UTC)
commit 1a31a3c7d7d125c3e9fc23fa419e063b57281d48
Author: Julien Puydt <jpuydt free fr>
Date: Mon Feb 11 10:59:39 2013 +0100
Made sure the STUN detector code doesn't crash if we quit-at-startup
lib/engine/components/opal/opal-call-manager.cpp | 9 +++++++--
lib/engine/components/opal/opal-call-manager.h | 1 +
2 files changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/lib/engine/components/opal/opal-call-manager.cpp
b/lib/engine/components/opal/opal-call-manager.cpp
index 17bc02e..9de8303 100644
--- a/lib/engine/components/opal/opal-call-manager.cpp
+++ b/lib/engine/components/opal/opal-call-manager.cpp
@@ -103,6 +103,8 @@ using namespace Opal;
CallManager::CallManager (Ekiga::ServiceCore & _core)
: core (_core)
{
+ stun_thread = 0;
+
/* Initialise the endpoint parameters */
#if P_HAS_IPV6
char * ekiga_ipv6 = getenv("EKIGA_IPV6");
@@ -159,6 +161,8 @@ CallManager::CallManager (Ekiga::ServiceCore & _core)
CallManager::~CallManager ()
{
+ if (stun_thread)
+ stun_thread->WaitForTermination ();
ClearAllCalls (OpalConnection::EndedByLocalUser, true);
ShutDownEndpoints ();
@@ -529,10 +533,10 @@ void CallManager::set_stun_server (const std::string & server)
void CallManager::set_stun_enabled (bool enabled)
{
stun_enabled = enabled;
- if (stun_enabled) {
+ if (stun_enabled && stun_thread) {
// Ready
- new StunDetector (stun_server, *this, queue);
+ stun_thread = new StunDetector (stun_server, *this, queue);
patience = 20;
Ekiga::Runtime::run_in_main (boost::bind (&CallManager::HandleSTUNResult, this), 1);
} else
@@ -806,6 +810,7 @@ CallManager::HandleSTUNResult ()
PSTUNClient::NatTypes result
= (PSTUNClient::NatTypes)(GPOINTER_TO_UINT (g_async_queue_pop (queue))-1);
got_answer = true;
+ stun_thread = 0;
if (result == PSTUNClient::SymmetricNat
|| result == PSTUNClient::BlockedNat
diff --git a/lib/engine/components/opal/opal-call-manager.h b/lib/engine/components/opal/opal-call-manager.h
index 7acb8b9..5b6ba4d 100644
--- a/lib/engine/components/opal/opal-call-manager.h
+++ b/lib/engine/components/opal/opal-call-manager.h
@@ -166,6 +166,7 @@ private:
void GetAllowedFormats (OpalMediaFormatList & full_list);
+ PThread* stun_thread;
void HandleSTUNResult ();
void ReportSTUNError (const std::string error);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]