summaryrefslogtreecommitdiff
path: root/cpp
diff options
context:
space:
mode:
authorMarc Laukien <marc@zeroc.com>2002-07-29 20:31:14 +0000
committerMarc Laukien <marc@zeroc.com>2002-07-29 20:31:14 +0000
commitf867ba38e2d7ee0c8edb4c4680334cf11ee9e2c2 (patch)
treeba65f86e6c15863a3be8e690bef89b7288a3fa13 /cpp
parentfix (diff)
downloadice-f867ba38e2d7ee0c8edb4c4680334cf11ee9e2c2.tar.bz2
ice-f867ba38e2d7ee0c8edb4c4680334cf11ee9e2c2.tar.xz
ice-f867ba38e2d7ee0c8edb4c4680334cf11ee9e2c2.zip
leak fix
Diffstat (limited to 'cpp')
-rw-r--r--cpp/config/TestUtil.py4
-rw-r--r--cpp/include/Ice/RoutingTable.h5
-rw-r--r--cpp/src/Ice/RouterInfo.cpp14
-rw-r--r--cpp/src/Ice/RouterInfo.h6
-rw-r--r--cpp/src/Ice/RoutingTable.cpp7
-rwxr-xr-xcpp/test/Glacier/starter/run.py9
6 files changed, 36 insertions, 9 deletions
diff --git a/cpp/config/TestUtil.py b/cpp/config/TestUtil.py
index 8ff5e1af860..8bbd35bbf4b 100644
--- a/cpp/config/TestUtil.py
+++ b/cpp/config/TestUtil.py
@@ -16,8 +16,8 @@ import sys, os
# protocol. Otherwise TCP is used.
#
-protocol = "ssl"
-#protocol = ""
+#protocol = "ssl"
+protocol = ""
#
# Set compressed to 1 in case you want to run the tests with
diff --git a/cpp/include/Ice/RoutingTable.h b/cpp/include/Ice/RoutingTable.h
index 1da4faa8b86..558fa41d9da 100644
--- a/cpp/include/Ice/RoutingTable.h
+++ b/cpp/include/Ice/RoutingTable.h
@@ -33,6 +33,11 @@ public:
RoutingTable();
//
+ // Clear the contents of the routing table.
+ //
+ void clear();
+
+ //
// Returns false if the Proxy exists already.
//
bool add(const ::Ice::ObjectPrx&);
diff --git a/cpp/src/Ice/RouterInfo.cpp b/cpp/src/Ice/RouterInfo.cpp
index 32d8dbdfd52..e695ad0214d 100644
--- a/cpp/src/Ice/RouterInfo.cpp
+++ b/cpp/src/Ice/RouterInfo.cpp
@@ -12,6 +12,7 @@
#include <Ice/Router.h>
#include <Ice/RoutingTable.h>
#include <Ice/LocalException.h>
+#include <Ice/Functional.h>
using namespace std;
using namespace Ice;
@@ -33,6 +34,8 @@ IceInternal::RouterManager::destroy()
{
IceUtil::Mutex::Lock sync(*this);
+ for_each(_table.begin(), _table.end(), Ice::secondVoidMemFun<RouterPrx, RouterInfo>(&RouterInfo::destroy));
+
_table.clear();
_tableHint = _table.end();
}
@@ -83,6 +86,17 @@ IceInternal::RouterInfo::RouterInfo(const RouterPrx& router) :
assert(_router);
}
+void
+IceInternal::RouterInfo::destroy()
+{
+ IceUtil::Mutex::Lock sync(*this);
+
+ _clientProxy = 0;
+ _serverProxy = 0;
+ _adapter = 0;
+ _routingTable->clear();
+}
+
bool
IceInternal::RouterInfo::operator==(const RouterInfo& rhs) const
{
diff --git a/cpp/src/Ice/RouterInfo.h b/cpp/src/Ice/RouterInfo.h
index 3504a0bea89..3af6bb426a3 100644
--- a/cpp/src/Ice/RouterInfo.h
+++ b/cpp/src/Ice/RouterInfo.h
@@ -47,6 +47,8 @@ public:
RouterInfo(const ::Ice::RouterPrx&);
+ void destroy();
+
bool operator==(const RouterInfo&) const;
bool operator!=(const RouterInfo&) const;
bool operator<(const RouterInfo&) const;
@@ -62,10 +64,10 @@ public:
private:
- ::Ice::RouterPrx _router;
+ ::Ice::RouterPrx _router; // Immutable.
::Ice::ObjectPrx _clientProxy;
::Ice::ObjectPrx _serverProxy;
- RoutingTablePtr _routingTable;
+ RoutingTablePtr _routingTable; // Immutable.
::Ice::ObjectAdapterPtr _adapter;
};
diff --git a/cpp/src/Ice/RoutingTable.cpp b/cpp/src/Ice/RoutingTable.cpp
index f4038b0ec71..999fc5eba60 100644
--- a/cpp/src/Ice/RoutingTable.cpp
+++ b/cpp/src/Ice/RoutingTable.cpp
@@ -23,6 +23,13 @@ IceInternal::RoutingTable::RoutingTable() :
{
}
+void
+IceInternal::RoutingTable::clear()
+{
+ _table.clear();
+ _tableHint = _table.end();
+}
+
bool
IceInternal::RoutingTable::add(const ObjectPrx& prx)
{
diff --git a/cpp/test/Glacier/starter/run.py b/cpp/test/Glacier/starter/run.py
index fc1cc23899a..acaf9119d4a 100755
--- a/cpp/test/Glacier/starter/run.py
+++ b/cpp/test/Glacier/starter/run.py
@@ -47,14 +47,13 @@ name = os.path.join("Glacier", "starter")
TestUtil.mixedClientServerTest(toplevel, name)
print "shutting down glacier starter...",
-TestUtil.killServers() # TODO: Graceful shutdown
+TestUtil.killServers() # TODO: Graceful shutdown.
print "ok"
starterStatus = starterPipe.close()
-# TODO: Enable again when we have graceful server starter shutdown.
-#if starterStatus:
-# TestUtil.killServers()
-# sys.exit(1)
+if starterStatus:
+ TestUtil.killServers()
+ #sys.exit(1) # TODO: Uncomment when when we have graceful shutdown.
sys.exit(0)