[asterisk-scf-commits] asterisk-scf/release/sip.git branch "master" updated.

Commits to the Asterisk SCF project code repositories asterisk-scf-commits at lists.digium.com
Thu Jan 5 10:12:01 CST 2012


branch "master" has been updated
       via  b046455173036ccce22886697ea423c091323fd9 (commit)
      from  872c1fcf062ceb5d0e46383b3ee9da4a65545e58 (commit)

Summary of changes:
 src/SIPSession.cpp              |    2 ++
 src/SIPTelephonyEventSink.cpp   |   34 ++++++++++++++++++++++++++++------
 src/SIPTelephonyEventSink.h     |    4 +++-
 src/SIPTelephonyEventSource.cpp |   31 ++++++++++++++++++++++++++-----
 src/SIPTelephonyEventSource.h   |    4 +++-
 5 files changed, 62 insertions(+), 13 deletions(-)


- Log -----------------------------------------------------------------
commit b046455173036ccce22886697ea423c091323fd9
Author: Joshua Colp <jcolp at digium.com>
Date:   Thu Jan 5 12:00:18 2012 -0400

    Send back an object not exist exception if the telephony event source or sink are logically destroyed and workqueue items execute afterwards. (issue ASTSCF-290)

diff --git a/src/SIPSession.cpp b/src/SIPSession.cpp
index d8a1f73..f1a4ac8 100755
--- a/src/SIPSession.cpp
+++ b/src/SIPSession.cpp
@@ -2686,10 +2686,12 @@ public:
         mSessionPriv->mAdapter->remove(mSessionPriv->mMediaSessionProxy->ice_getIdentity());
         if (mSessionPriv->mEventSink)
         {
+            mSessionPriv->mEventSink->setDestroyed();
             mSessionPriv->mAdapter->remove(mSessionPriv->mEventSinkPrx->ice_getIdentity());
         }
         if (mSessionPriv->mEventSource)
         {
+            mSessionPriv->mEventSource->setDestroyed();
             mSessionPriv->mAdapter->remove(mSessionPriv->mEventSourcePrx->ice_getIdentity());
         }
         mSessionPriv->mMediaSession = 0;
diff --git a/src/SIPTelephonyEventSink.cpp b/src/SIPTelephonyEventSink.cpp
index 6aec733..9dda45b 100644
--- a/src/SIPTelephonyEventSink.cpp
+++ b/src/SIPTelephonyEventSink.cpp
@@ -30,11 +30,18 @@ public:
     WriteTelephonyEvent(
             const AsteriskSCF::SessionCommunications::V1::AMD_TelephonyEventSink_writePtr& cb,
             const AsteriskSCF::SessionCommunications::V1::TelephonyEventPtr& event,
-            pjsip_inv_session *inv)
-        : mCB(cb), mEvent(event), mInv(inv) { }
+            pjsip_inv_session *inv,
+            const SIPTelephonyEventSinkPtr& sink)
+        : mCB(cb), mEvent(event), mInv(inv), mSink(sink) { }
 
     SuspendableWorkResult execute(const SuspendableWorkListenerPtr&)
     {
+        if (mSink->isDestroyed() == true)
+        {
+            mCB->ice_exception(Ice::ObjectNotExistException(__FILE__, __LINE__));
+            return Complete;
+        }
+
         AsteriskSCF::SessionCommunications::V1::BeginDTMFEventPtr beginDTMF;
         AsteriskSCF::SessionCommunications::V1::EndDTMFEventPtr endDTMF;
         AsteriskSCF::SessionCommunications::V1::FlashEventPtr flash;
@@ -138,6 +145,7 @@ private:
     AsteriskSCF::SessionCommunications::V1::AMD_TelephonyEventSink_writePtr mCB;
     AsteriskSCF::SessionCommunications::V1::TelephonyEventPtr mEvent;
     pjsip_inv_session *mInv;
+    SIPTelephonyEventSinkPtr mSink;
 };
 
 
@@ -149,7 +157,7 @@ void SIPTelephonyEventSink::write_async(
         const AsteriskSCF::SessionCommunications::V1::TelephonyEventPtr& event,
         const Ice::Current&)
 {
-    mSessionWork->enqueueWork(new WriteTelephonyEvent(cb, event, mInv));
+    mSessionWork->enqueueWork(new WriteTelephonyEvent(cb, event, mInv, this));
 }
 
 class SetTelephonyEventSource : public SuspendableWork
@@ -163,8 +171,15 @@ public:
 
     SuspendableWorkResult execute(const SuspendableWorkListenerPtr&)
     {
-        mSink->setSource(mSource);
-        mCB->ice_response();
+        if (mSink->isDestroyed() == true)
+        {
+            mCB->ice_exception(Ice::ObjectNotExistException(__FILE__, __LINE__));
+        }
+        else
+        {
+            mSink->setSource(mSource);
+            mCB->ice_response();
+        }
         return Complete;
     }
 private:
@@ -196,7 +211,14 @@ public:
 
     SuspendableWorkResult execute(const SuspendableWorkListenerPtr&)
     {
-        mCB->ice_response(mSink->getSource());
+        if (mSink->isDestroyed() == true)
+        {
+            mCB->ice_exception(Ice::ObjectNotExistException(__FILE__, __LINE__));
+        }
+        else
+        {
+            mCB->ice_response(mSink->getSource());
+        }
         return Complete;
     }
 private:
diff --git a/src/SIPTelephonyEventSink.h b/src/SIPTelephonyEventSink.h
index d1022ee..8b76299 100644
--- a/src/SIPTelephonyEventSink.h
+++ b/src/SIPTelephonyEventSink.h
@@ -16,13 +16,15 @@
 #pragma once
 #include "SIPSession.h"
 
+#include <AsteriskSCF/WorkQueue/Dispatched.h>
+
 namespace AsteriskSCF
 {
 
 namespace SIPSessionManager
 {
 
-class SIPTelephonyEventSink : public AsteriskSCF::SessionCommunications::V1::TelephonyEventSink
+class SIPTelephonyEventSink : public AsteriskSCF::SessionCommunications::V1::TelephonyEventSink, public AsteriskSCF::WorkQueue::Dispatched
 {
 public:
     SIPTelephonyEventSink(const SessionWorkPtr& sessionWork, pjsip_inv_session *inv);
diff --git a/src/SIPTelephonyEventSource.cpp b/src/SIPTelephonyEventSource.cpp
index a2f6c79..08dde41 100644
--- a/src/SIPTelephonyEventSource.cpp
+++ b/src/SIPTelephonyEventSource.cpp
@@ -50,8 +50,15 @@ public:
 
     SuspendableWorkResult execute(const SuspendableWorkListenerPtr&)
     {
-        mSource->addSinks(mSinks);
-        mCB->ice_response();
+        if (mSource->isDestroyed() == true)
+        {
+            mCB->ice_exception(Ice::ObjectNotExistException(__FILE__, __LINE__));
+        }
+        else
+        {
+            mSource->addSinks(mSinks);
+            mCB->ice_response();
+        }
         return Complete;
     }
 private:
@@ -71,8 +78,15 @@ public:
 
     SuspendableWorkResult execute(const SuspendableWorkListenerPtr&)
     {
-        mSource->removeSinks(mSinks);
-        mCB->ice_response();
+        if (mSource->isDestroyed() == true)
+        {
+            mCB->ice_exception(Ice::ObjectNotExistException(__FILE__, __LINE__));
+        }
+        else
+        {
+            mSource->removeSinks(mSinks);
+            mCB->ice_response();
+        }
         return Complete;
     }
 private:
@@ -126,7 +140,14 @@ public:
 
     SuspendableWorkResult execute(const SuspendableWorkListenerPtr&)
     {
-        mCB->ice_response(mSource->getSinks());
+        if (mSource->isDestroyed() == true)
+        {
+            mCB->ice_exception(Ice::ObjectNotExistException(__FILE__, __LINE__));
+        }
+        else
+        {
+            mCB->ice_response(mSource->getSinks());
+        }
         return Complete;
     }
 private:
diff --git a/src/SIPTelephonyEventSource.h b/src/SIPTelephonyEventSource.h
index 3be3844..91f3612 100644
--- a/src/SIPTelephonyEventSource.h
+++ b/src/SIPTelephonyEventSource.h
@@ -17,13 +17,15 @@
 #pragma once
 #include "SIPSession.h"
 
+#include <AsteriskSCF/WorkQueue/Dispatched.h>
+
 namespace AsteriskSCF
 {
 
 namespace SIPSessionManager
 {
 
-class SIPTelephonyEventSource : public AsteriskSCF::SessionCommunications::V1::TelephonyEventSource
+class SIPTelephonyEventSource : public AsteriskSCF::SessionCommunications::V1::TelephonyEventSource, public AsteriskSCF::WorkQueue::Dispatched
 {
 public:
 

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


-- 
asterisk-scf/release/sip.git



More information about the asterisk-scf-commits mailing list