[asterisk-scf-commits] asterisk-scf/release/bridging.git branch "master" updated.
Commits to the Asterisk SCF project code repositories
asterisk-scf-commits at lists.digium.com
Wed Feb 8 21:46:47 CST 2012
branch "master" has been updated
via d613fcbc05fdaa1f05adc1bb4e62a935bd0efa37 (commit)
from 3d96dc7671b99f124b9cf984886039ba578962c7 (commit)
Summary of changes:
config/test_bridging.conf | 4 ++--
src/BridgeImpl.cpp | 23 ++++++++++++++++++++++-
src/SessionCollection.cpp | 2 +-
src/SessionWrapper.cpp | 11 +++++++++++
src/SessionWrapper.h | 2 ++
src/Tasks.h | 5 +++++
test/TestBridging.cpp | 27 +++++++++++++++++++++++++--
7 files changed, 68 insertions(+), 6 deletions(-)
- Log -----------------------------------------------------------------
commit d613fcbc05fdaa1f05adc1bb4e62a935bd0efa37
Author: Brent Eagles <beagles at digium.com>
Date: Thu Feb 9 00:13:25 2012 -0330
- More explicit cleanup of session collections.
- Extra cleanup added to test suite.
- Fix an insane bug in SessionCollection
- Figured out that command line arguments must be used to disable
the global leak detection, or the detect_memory_leaks(0) call has
to be placed so it executes *after* boost::test::init() is called.
- Knock the logging level down a bit in the configuration.
diff --git a/config/test_bridging.conf b/config/test_bridging.conf
index 18f8235..2854d81 100644
--- a/config/test_bridging.conf
+++ b/config/test_bridging.conf
@@ -82,7 +82,7 @@ TestBridge.ServiceAdapter.ThreadPool.Size=2
TestBridge.BackplaneAdapter.Endpoints=default -h 127.0.0.1 -p 57001
TestBridge.BackplaneAdapter.ThreadPool.Size=2
TestBridge.Standby=false
-TestBridge.LogLevel=0
+TestBridge.LogLevel=1
TestBridge2.InstanceName=TestBridge2
TestBridge2.BridgeManagerObjectId=TestBridgeManager2
@@ -91,7 +91,7 @@ TestBridge2.ServiceAdapter.Endpoints=default -h 127.0.0.1 -p 57010
TestBridge2.ServiceAdapter.ThreadPool.Size=4
TestBridge2.BackplaneAdapter.Endpoints=default -h 127.0.0.1 -p 57011
TestBridge2.BackplaneAdapter.ThreadPool.Size=4
-TestBridge2.LogLevel=0
+TestBridge2.LogLevel=1
#Ice.Trace.Network=1
#Ice.Trace.Protocol=1
diff --git a/src/BridgeImpl.cpp b/src/BridgeImpl.cpp
index 765ae55..688e61f 100755
--- a/src/BridgeImpl.cpp
+++ b/src/BridgeImpl.cpp
@@ -1613,6 +1613,7 @@ void BridgeImpl::shutdown(const Ice::Current& current)
update = createUpdate();
}
pushUpdate(update);
+ SessionCollectionPtr currentCollection;
{
//
// Currently the slice defines the response "Normal Clearing" as the default
@@ -1630,6 +1631,12 @@ void BridgeImpl::shutdown(const Ice::Current& current)
//
mObjAdapter->remove(mSessionListenerPrx->ice_getIdentity());
mSessionListener = 0;
+ currentCollection = mSessions;
+ mSessions = 0;
+ }
+ if (currentCollection)
+ {
+ currentCollection->destroy();
}
try
@@ -1652,6 +1659,7 @@ void BridgeImpl::destroy(const Ice::Current& current)
{
mLogger(Trace) << FUNLOG << ":" << objectIdFromCurrent(current);
BridgeStateItemPtr update;
+ SessionCollectionPtr currentCollection;
{
boost::unique_lock<boost::shared_mutex> lock(mLock);
if (mState->runningState == ShuttingDown)
@@ -1669,6 +1677,12 @@ void BridgeImpl::destroy(const Ice::Current& current)
mListeners->stopped(getCookies());
mSessionListener = 0;
update = createUpdate();
+ currentCollection = mSessions;
+ mSessions = 0;
+ }
+ if (currentCollection)
+ {
+ currentCollection->destroy();
}
pushUpdate(update);
@@ -1916,12 +1930,14 @@ bool BridgeImpl::destroyed()
void BridgeImpl::destroyImpl()
{
+ SessionCollectionPtr currentCollection;
try
{
boost::unique_lock<boost::shared_mutex> lock(mLock);
mState->runningState = Destroyed;
+ currentCollection = mSessions;
mSessions = 0;
-
+ mSessionListener = 0;
if (mObjAdapter && mState)
{
mObjAdapter->remove(mObjAdapter->getCommunicator()->stringToIdentity(mState->bridgeId));
@@ -1931,6 +1947,11 @@ void BridgeImpl::destroyImpl()
{
}
+ if (currentCollection)
+ {
+ currentCollection->destroy();
+ }
+
try
{
if (replicate())
diff --git a/src/SessionCollection.cpp b/src/SessionCollection.cpp
index 9b6c815..2f09558 100644
--- a/src/SessionCollection.cpp
+++ b/src/SessionCollection.cpp
@@ -232,7 +232,7 @@ void SessionCollection::destroy()
copy = mMap;
mMap.clear();
}
- for (SessionMap::iterator i = copy.begin(); i != copy.end();)
+ for (SessionMap::iterator i = copy.begin(); i != copy.end(); ++i)
{
i->second->destroy();
}
diff --git a/src/SessionWrapper.cpp b/src/SessionWrapper.cpp
index 5996a76..6854188 100644
--- a/src/SessionWrapper.cpp
+++ b/src/SessionWrapper.cpp
@@ -397,6 +397,17 @@ SessionWrapper::SessionWrapper(const BridgedSessionPtr& session,
{
}
+SessionWrapper::~SessionWrapper()
+{
+ try
+ {
+ mLogger(Trace) << "SessionWrapper::~SessionWrapper(): " << mId;
+ }
+ catch (...)
+ {
+ }
+}
+
bool SessionWrapper::isConnected()
{
boost::shared_lock<boost::shared_mutex> lock(mLock);
diff --git a/src/SessionWrapper.h b/src/SessionWrapper.h
index b03acc4..1dcc56e 100644
--- a/src/SessionWrapper.h
+++ b/src/SessionWrapper.h
@@ -35,6 +35,8 @@ public:
const AsteriskSCF::BridgeService::ReplicatorSmartPrx& replicator,
const AsteriskSCF::System::Logging::Logger& logger);
+ virtual ~SessionWrapper();
+
/**
* The following methods are helper methods for handling changes to sessions
* based on internal operations or listener calls.
diff --git a/src/Tasks.h b/src/Tasks.h
index 3487abb..882cab1 100644
--- a/src/Tasks.h
+++ b/src/Tasks.h
@@ -321,6 +321,8 @@ public:
current->fail();
current = popNextTask();
}
+ boost::unique_lock<boost::shared_mutex> lock(mLock);
+ mTasks.clear();
}
//
@@ -345,6 +347,8 @@ public:
current->destroy();
current = popNextTask();
}
+ boost::unique_lock<boost::shared_mutex> lock(mLock);
+ mTasks.clear();
}
/**
@@ -407,6 +411,7 @@ protected:
AsteriskSCF::System::Logging::Logger mLogger;
bool mStopped;
std::string mName;
+
};
typedef IceUtil::Handle<Executor> ExecutorPtr;
diff --git a/test/TestBridging.cpp b/test/TestBridging.cpp
index 1dc64e2..d096398 100644
--- a/test/TestBridging.cpp
+++ b/test/TestBridging.cpp
@@ -207,6 +207,7 @@ public:
// of char*.
//
mArgs.insert(mArgs.begin(), "BRIDGE_TEST_SERVICE");
+ mArgs.push_back("--detect_memory_leaks=0");
for (Ice::StringSeq::const_iterator i = mArgs.begin(); i != mArgs.end(); ++i)
{
mArgv.push_back(i->c_str());
@@ -1559,9 +1560,23 @@ public:
int argc = (int) globalTestEnvironment->argc();
char** argv = globalTestEnvironment->argv();
- ::boost::debug::detect_memory_leaks(false);
::boost::unit_test::unit_test_log.set_stream( std::cout );
int r = ::boost::unit_test::unit_test_main(&init_unit_test, argc, argv);
+ try
+ {
+ IceEnvironment testEnv(globalTestEnvironment->properties());
+ BridgeManagerPrx mgrPrx = globalTestEnvironment->primaryBridgeManager();
+ cleanupBridges(mgrPrx);
+ mgrPrx->shutdown();
+ }
+ catch (const std::exception& ex)
+ {
+ std::cerr << "Unexpected Ice exception " << ex.what() << std::endl;
+ }
+ catch (...)
+ {
+ std::cerr << "Unexpected exception" << std::endl;
+ }
exit(r);
Ice::InitializationData initData;
@@ -1570,8 +1585,15 @@ public:
IceBox::ServiceManagerPrx mgr = IceBox::ServiceManagerPrx::checkedCast(t->propertyToProxy("IceBoxMgr.Proxy"));
if (mgr)
{
- mgr->shutdown();
+ try
+ {
+ mgr->shutdown();
+ }
+ catch (...)
+ {
+ }
}
+ globalTestEnvironment = 0;
}
};
@@ -1587,6 +1609,7 @@ public:
void start(const std::string&, const Ice::CommunicatorPtr& communicator, const Ice::StringSeq& args)
{
globalTestEnvironment = new TestEnvironment(communicator, args);
+
mRunner = new TestRunner;
mRunner->start();
}
-----------------------------------------------------------------------
--
asterisk-scf/release/bridging.git
More information about the asterisk-scf-commits
mailing list