[asterisk-scf-commits] asterisk-scf/integration/media_rtp_pjmedia.git branch "retry_deux" updated.
Commits to the Asterisk SCF project code repositories
asterisk-scf-commits at lists.digium.com
Mon Apr 30 11:13:48 CDT 2012
branch "retry_deux" has been updated
via 46070fea0504e5a8a3ef5c98013fcdf76e5c6931 (commit)
from d3d13a005deab7a14c5f1a4e72d8e03a3c89757f (commit)
Summary of changes:
src/RTPStateReplicatorListener.cpp | 36 ++++++++++++++++++++++++++++--------
1 files changed, 28 insertions(+), 8 deletions(-)
- Log -----------------------------------------------------------------
commit 46070fea0504e5a8a3ef5c98013fcdf76e5c6931
Author: Brent Eagles <beagles at digium.com>
Date: Mon Apr 30 13:42:47 2012 -0230
Add some internal exception handling blocks and asserts for some
potentially "bad things".
diff --git a/src/RTPStateReplicatorListener.cpp b/src/RTPStateReplicatorListener.cpp
index 8e43755..07ec361 100644
--- a/src/RTPStateReplicatorListener.cpp
+++ b/src/RTPStateReplicatorListener.cpp
@@ -52,6 +52,7 @@ public:
ReplicationAdapterPtr getSession()
{
+ assert(mSession);
return mSession;
}
@@ -111,15 +112,34 @@ public:
if (i == mImpl->mStateItems.end())
{
- boost::shared_ptr<RTPStateReplicatorItem> newitem(new RTPStateReplicatorItem());
- localitem = newitem;
- mImpl->mStateItems.insert(make_pair(item->sessionId, newitem));
-
+ localitem.reset(new RTPStateReplicatorItem);
RTPAllocationOutputsPtr outputs (new RTPAllocationOutputs);
-
- localitem->setSession(
- AsteriskSCF::PJMEDIARTP::RTPSession::create(mImpl->mAdapter, mImpl->mEnvironment, item,
- mImpl->mReplicationContext, mImpl->mConfigurationService, item->options, outputs));
+ try
+ {
+ localitem->setSession(
+ AsteriskSCF::PJMEDIARTP::RTPSession::create(mImpl->mAdapter, mImpl->mEnvironment, item,
+ mImpl->mReplicationContext, mImpl->mConfigurationService, item->options, outputs));
+ }
+ catch (const std::exception&)
+ {
+ //
+ // TODO: logging would not go awry here.
+ //
+ assert(false);
+ return;
+ }
+ catch (...)
+ {
+ assert(false);
+ return;
+ }
+
+ //
+ // Insertion should happen after the session creation
+ // to make sure we don't end up with garbage in the
+ // case of an exception.
+ //
+ mImpl->mStateItems.insert(make_pair(item->sessionId, localitem));
}
else
{
-----------------------------------------------------------------------
--
asterisk-scf/integration/media_rtp_pjmedia.git
More information about the asterisk-scf-commits
mailing list