Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mumble-voip/mumble-scripts.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Hacker <dd0t@users.sourceforge.net>2012-07-10 02:59:58 +0400
committerStefan Hacker <dd0t@users.sourceforge.net>2012-07-10 03:12:24 +0400
commit16067ff55d46253b0c9761bdb276f864dfc188ac (patch)
treedc5190e59c632059e3db73eb7a7fb004fc99862c
parent0dcae890da7b45b6cc459b901a5d55e303bf3988 (diff)
Applied missing aggressive attachment patch to SMF2.0 authenticator.
-rw-r--r--Authenticators/SMF/1.x/smfauth.py2
-rwxr-xr-x[-rw-r--r--]Authenticators/SMF/2.0/smfauth.py35
2 files changed, 16 insertions, 21 deletions
diff --git a/Authenticators/SMF/1.x/smfauth.py b/Authenticators/SMF/1.x/smfauth.py
index 02376bb..2f0e901 100644
--- a/Authenticators/SMF/1.x/smfauth.py
+++ b/Authenticators/SMF/1.x/smfauth.py
@@ -752,7 +752,7 @@ def do_main_program():
class CustomLogger(Ice.Logger):
"""
Logger implementation to pipe Ice log messages into
- out own log
+ our own log
"""
def __init__(self):
diff --git a/Authenticators/SMF/2.0/smfauth.py b/Authenticators/SMF/2.0/smfauth.py
index f6cc22c..fa6c6d8 100644..100755
--- a/Authenticators/SMF/2.0/smfauth.py
+++ b/Authenticators/SMF/2.0/smfauth.py
@@ -259,7 +259,7 @@ def do_main_program():
return 1
if cfg.ice.watchdog > 0:
- self.metaUptime = -1
+ self.failedWatch = True
self.checkConnection()
# Serve till we are stopped
@@ -305,20 +305,21 @@ def do_main_program():
return self.attachCallbacks()
- def attachCallbacks(self):
+ def attachCallbacks(self, quiet = False):
"""
Attaches all callbacks for meta and authenticators
"""
# Ice.ConnectionRefusedException
- debug('Attaching callbacks')
+ #debug('Attaching callbacks')
try:
- info('Attaching meta callback')
+ if not quiet: info('Attaching meta callback')
+
self.meta.addCallback(self.metacb)
for server in self.meta.getBootedServers():
if not cfg.murmur.servers or server.id() in cfg.murmur.servers:
- info('Setting authenticator for virtual server %d', server.id())
+ if not quiet: info('Setting authenticator for virtual server %d', server.id())
server.setAuthenticator(self.auth)
except (Murmur.InvalidSecretException, Ice.UnknownUserException, Ice.ConnectionRefusedException), e:
@@ -339,26 +340,20 @@ def do_main_program():
def checkConnection(self):
"""
- Tries to retrieve the server uptime to determine wheter the server is
- still responsive or has restarted in the meantime
+ Tries reapplies all callbacks to make sure the authenticator
+ survives server restarts and disconnects.
"""
#debug('Watchdog run')
+
try:
- uptime = self.meta.getUptime()
- if self.metaUptime > 0:
- # Check if the server didn't restart since we last checked, we assume
- # since the last time we ran this check the watchdog interval +/- 5s
- # have passed. This should be replaced by implementing a Keepalive in
- # Murmur.
- if not ((uptime - 5) <= (self.metaUptime + cfg.ice.watchdog) <= (uptime + 5)):
- # Seems like the server restarted, re-attach the callbacks
- self.attachCallbacks()
-
- self.metaUptime = uptime
+ if not self.attachCallbacks(quiet = not self.failedWatch):
+ self.failedWatch = True
+ else:
+ self.failedWatch = False
except Ice.Exception, e:
- error('Connection to server lost, will try to reestablish callbacks in next watchdog run (%ds)', cfg.ice.watchdog)
+ error('Failed connection check, will retry in next watchdog run (%ds)', cfg.ice.watchdog)
debug(str(e))
- self.attachCallbacks()
+ self.failedWatch = True
# Renew the timer
self.watchdog = Timer(cfg.ice.watchdog, self.checkConnection)