From 2f418fde898ca4f11be1b8c5c039161ff4b420dd Mon Sep 17 00:00:00 2001 From: Michael Ziegler Date: Sun, 19 Jul 2009 19:35:52 +0200 Subject: [PATCH] implemented auto port assignment - not such a clean way, but it should work. fixes #6 --- pyweb/mumble/models.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pyweb/mumble/models.py b/pyweb/mumble/models.py index da8b72d..9166fc0 100755 --- a/pyweb/mumble/models.py +++ b/pyweb/mumble/models.py @@ -117,6 +117,12 @@ class Mumble( models.Model ): if self.id is None: self.srvid = self.ctl.newServer(); + if self.port is None: + self.port = max( [ mm.port for mm in Mumble.objects.all() ] ) + 1; + if self.port > 2**16: + self.port -= 30000; + + self.ctl.setConf( self.srvid, 'host', socket.gethostbyname( self.addr ) ); self.ctl.setConf( self.srvid, 'registername', self.name ); self.ctl.setConf( self.srvid, 'registerurl', self.url );