summaryrefslogtreecommitdiff
path: root/py/python
diff options
context:
space:
mode:
authorJose <jose@zeroc.com>2014-12-11 22:16:22 +0100
committerJose <jose@zeroc.com>2014-12-11 22:16:22 +0100
commit1f781d86fa2591f3baf8d145602c3af8e4179ecf (patch)
tree002b70cee4d81ebd409e91452987de7a82327352 /py/python
parentFixed (ICE-6160) - Python Glacier2 Application always leaks a communicator (diff)
downloadice-1f781d86fa2591f3baf8d145602c3af8e4179ecf.tar.bz2
ice-1f781d86fa2591f3baf8d145602c3af8e4179ecf.tar.xz
ice-1f781d86fa2591f3baf8d145602c3af8e4179ecf.zip
Fixed (ICE-6161) - Glacier2.Application does not set acm ConnectionCallback
Diffstat (limited to 'py/python')
-rw-r--r--py/python/Glacier2.py31
1 files changed, 26 insertions, 5 deletions
diff --git a/py/python/Glacier2.py b/py/python/Glacier2.py
index fabb926072d..448d7bbd6de 100644
--- a/py/python/Glacier2.py
+++ b/py/python/Glacier2.py
@@ -75,6 +75,17 @@ class SessionPingThread(threading.Thread):
#
self.done()
self._app.sessionDestroyed()
+
+class ConnectionCallbackI(Ice.ConnectionCallback):
+ def __init__(self, app):
+ self._app = app
+
+ def heartbeat(self, conn):
+ pass
+
+ def closed(self, conn):
+ self._app.sessionDestroyed()
+
class Application(Ice.Application):
@@ -172,10 +183,21 @@ Application.NoSignalHandling.
status = 1
if Application._createdSession:
- timeout = Application._router.getSessionTimeout();
- if timeout > 0:
- ping = SessionPingThread(self, Application._router, timeout / 2)
- ping.start()
+ acmTimeout = 0
+ try:
+ acmTimeout = Application._router.getACMTimeout()
+ except(Ice.OperationNotExistException):
+ pass
+ if acmTimeout > 0:
+ connection = Application._router.ice_getCachedConnection()
+ assert(connection)
+ connection.setACM(acmTimeout, Ice.Unset, Ice.ACMHeartbeat.HeartbeatAlways)
+ connection.setCallback(ConnectionCallbackI(self))
+ else:
+ timeout = Application._router.getSessionTimeout()
+ if timeout > 0:
+ ping = SessionPingThread(self, Application._router, timeout / 2)
+ ping.start()
Application._category = Application._router.getCategoryForClient()
status = self.runWithSession(args)
@@ -251,7 +273,6 @@ Application.NoSignalHandling.
def doMain(self, args, initData):
# Set the default properties for all Glacier2 applications.
- initData.properties.setProperty("Ice.ACM.Client", "0")
initData.properties.setProperty("Ice.RetryIntervals", "-1")
restart = True