[asterisk-scf-commits] asterisk-scf/integration/mediatransportudptl.git branch "retry_deux" updated.

Commits to the Asterisk SCF project code repositories asterisk-scf-commits at lists.digium.com
Tue Apr 17 13:07:21 CDT 2012


branch "retry_deux" has been updated
       via  2ea16e1dd715e72d7aa014fd25391a50f41ba8c5 (commit)
      from  4fb4290226e744a8bfba3f97f3f3058b2a04af39 (commit)

Summary of changes:
 config/test_udptl_ice.conf |    2 --
 src/ICETransport.cpp       |   21 ++++++++++++++++++---
 2 files changed, 18 insertions(+), 5 deletions(-)
 mode change 100755 => 100644 config/UdptlConfigurator.py
 mode change 100755 => 100644 src/Configuration.h


- Log -----------------------------------------------------------------
commit 2ea16e1dd715e72d7aa014fd25391a50f41ba8c5
Author: Brent Eagles <beagles at digium.com>
Date:   Tue Apr 17 15:05:16 2012 -0230

    - Improved wait loop for local address resolution in session startup.
    - Removed 5 second timeout in configuration file that was causing incorrect fail results.

diff --git a/config/UdptlConfigurator.py b/config/UdptlConfigurator.py
old mode 100755
new mode 100644
diff --git a/config/test_udptl_ice.conf b/config/test_udptl_ice.conf
index 9e20ebd..7540bde 100644
--- a/config/test_udptl_ice.conf
+++ b/config/test_udptl_ice.conf
@@ -9,8 +9,6 @@ UDPTLConfiguration.Name=UDPTLStateReplicator
 IceBox.InheritProperties=1
 IceBox.LoadOrder=ServiceDiscovery,UDPTLStateReplicator,MediaTransportUDPTL,TestMediaTransportUDPTL
 
-Ice.Override.Timeout=5000
-
 # RtpStateReplicator Configuration
 IceBox.Service.UDPTLStateReplicator=UDPTLStateReplicator:create
 
diff --git a/src/Configuration.h b/src/Configuration.h
old mode 100755
new mode 100644
diff --git a/src/ICETransport.cpp b/src/ICETransport.cpp
index 45bb1b6..99d15f6 100644
--- a/src/ICETransport.cpp
+++ b/src/ICETransport.cpp
@@ -710,6 +710,8 @@ void ICETransport::onSetupComplete(pjmedia_transport* transport, int status)
 {
     if (fail(status))
     {
+        boost::unique_lock<boost::mutex> lock(mLock);
+        mMonitor.notify_all();
         //
         // TODO!
         //
@@ -740,9 +742,9 @@ void ICETransport::onSetupComplete(pjmedia_transport* transport, int status)
             pj_memcpy(mLastKnownAddr.get(), &info.sock_info.rtp_addr_name, sizeof(pj_sockaddr));
         }
     }
-    boost::lock_guard<boost::mutex> lock(mLock);
+    boost::unique_lock<boost::mutex> lock(mLock);
     mLocalAddress = fromInfo(info);
-    mMonitor.notify_one();
+    mMonitor.notify_all();
 }
 
 AddressPtr ICETransport::localAddress() 
@@ -752,9 +754,21 @@ AddressPtr ICETransport::localAddress()
     {
         return mLocalAddress;
     }
+    //
+    // Retry check for local address for max of 2.5 seconds, then proceed as if it was unknown.
+    //
     for (size_t i = 0; i < 5 && !mLocalAddress; ++i)
     {
-        mMonitor.wait(lock);
+        try
+        {
+            mMonitor.timed_wait(lock, boost::posix_time::milliseconds(500));
+        }
+        catch (const boost::thread_interrupted&)
+        {
+        }
+        catch (const boost::thread_resource_error&)
+        {
+        }
     }
     return mLocalAddress;
 }
@@ -803,6 +817,7 @@ void ICETransport::start()
     {
         throw InternalInitializationException("Unable to create new ICE media transport");
     }
+
     ICECallbackAdapter::addEntry(t, shared_from_this());
     mTransport = t;
     mCallback = callback;

-----------------------------------------------------------------------


-- 
asterisk-scf/integration/mediatransportudptl.git



More information about the asterisk-scf-commits mailing list