Browse Source

use default instance port = server default port + server_id, and only set host/port if not default.

Natenom/support-murmur-13-1446181288462
Michael Ziegler 15 years ago
parent
commit
85a516110f
  1. 16
      pyweb/mumble/models.py

16
pyweb/mumble/models.py

@ -186,8 +186,16 @@ class Mumble( models.Model ):
'maxrange': 2**16, 'maxrange': 2**16,
}); });
if self.addr != '0.0.0.0':
self.ctl.setConf( self.srvid, 'host', socket.gethostbyname(self.addr) ); 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) ); 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, 'registername', self.name );
self.ctl.setConf( self.srvid, 'registerhostname', self.netloc ); self.ctl.setConf( self.srvid, 'registerhostname', self.netloc );
@ -227,16 +235,18 @@ class Mumble( models.Model ):
else: else:
self.name = conf["registername"]; self.name = conf["registername"];
defaultport = settings.MUMBLE_DEFAULT_PORT + self.srvid
if "registerhostname" in conf: if "registerhostname" in conf:
if ':' in conf["registerhostname"]: if ':' in conf["registerhostname"]:
regname, regport = conf["registerhostname"].split(':') regname, regport = conf["registerhostname"].split(':')
regport = int(regport) regport = int(regport)
else: else:
regname = conf["registerhostname"] regname = conf["registerhostname"]
regport = settings.MUMBLE_DEFAULT_PORT
regport = defaultport
else: else:
regname = None regname = None
regport = settings.MUMBLE_DEFAULT_PORT
regport = defaultport
if "host" in conf: if "host" in conf:
addr = conf["host"] addr = conf["host"]
@ -246,7 +256,7 @@ class Mumble( models.Model ):
if "port" in conf: if "port" in conf:
self.port = int(conf["port"]) self.port = int(conf["port"])
else: else:
self.port = settings.MUMBLE_DEFAULT_PORT
self.port = defaultport
if regname and addr: if regname and addr:
if regport == self.port: if regport == self.port:

Loading…
Cancel
Save