From 85a516110fdb79a31322ec672bd36395d227ef12 Mon Sep 17 00:00:00 2001 From: Michael Ziegler Date: Tue, 23 Feb 2010 20:21:58 +0100 Subject: [PATCH] use default instance port = server default port + server_id, and only set host/port if not default. --- pyweb/mumble/models.py | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/pyweb/mumble/models.py b/pyweb/mumble/models.py index 9c8d528..47e0d3f 100644 --- a/pyweb/mumble/models.py +++ b/pyweb/mumble/models.py @@ -186,8 +186,16 @@ class Mumble( models.Model ): 'maxrange': 2**16, }); - self.ctl.setConf( self.srvid, 'host', socket.gethostbyname(self.addr) ); - self.ctl.setConf( self.srvid, 'port', str(self.port) ); + if self.addr != '0.0.0.0': + self.ctl.setConf( self.srvid, 'host', socket.gethostbyname(self.addr) ); + else: + self.ctl.setConf( self.srvid, 'host', '' ); + + if self.port != settings.MUMBLE_DEFAULT_PORT + self.srvid: + self.ctl.setConf( self.srvid, 'port', str(self.port) ); + else: + self.ctl.setConf( self.srvid, 'port', '' ); + self.ctl.setConf( self.srvid, 'registername', self.name ); self.ctl.setConf( self.srvid, 'registerhostname', self.netloc ); @@ -227,16 +235,18 @@ class Mumble( models.Model ): else: self.name = conf["registername"]; + defaultport = settings.MUMBLE_DEFAULT_PORT + self.srvid + if "registerhostname" in conf: if ':' in conf["registerhostname"]: regname, regport = conf["registerhostname"].split(':') regport = int(regport) else: regname = conf["registerhostname"] - regport = settings.MUMBLE_DEFAULT_PORT + regport = defaultport else: regname = None - regport = settings.MUMBLE_DEFAULT_PORT + regport = defaultport if "host" in conf: addr = conf["host"] @@ -246,7 +256,7 @@ class Mumble( models.Model ): if "port" in conf: self.port = int(conf["port"]) else: - self.port = settings.MUMBLE_DEFAULT_PORT + self.port = defaultport if regname and addr: if regport == self.port: