def doSetUp(self, arg): """ Action method. """ self.hostname = settings.getIdServerHost() if self.hostname == '': self.hostname = strng.to_bin(misc.readExternalIP()) # bpio.ReadTextFile(settings.ExternalIPFilename()) if self.hostname == '': self.hostname = net_misc.getLocalIp() lg.out(4, 'id_server.doSetUp hostname=%s' % strng.to_text(self.hostname)) if not os.path.isdir(settings.IdentityServerDir()): os.makedirs(settings.IdentityServerDir()) lg.out(4, ' created a folder %s' % settings.IdentityServerDir()) root = WebRoot() root.putChild(b'', WebMainPage()) try: self.tcp_listener = reactor.listenTCP(self.tcp_port, IdServerFactory()) lg.out(4, " identity server listen on TCP port %d started" % (self.tcp_port)) except: lg.out(4, "id_server.set_up ERROR exception trying to listen on port " + str(self.tcp_port)) lg.exc() try: self.web_listener = reactor.listenTCP(self.web_port, server.Site(root)) lg.out(4, " have started web server at http://%s:%d " % (strng.to_text(self.hostname), self.web_port)) except: lg.out(4, "id_server.set_up ERROR exception trying to listen on port " + str(self.web_port)) lg.exc()
def doSetUp(self, arg): """ Action method. """ self.hostname = settings.getIdServerHost() if self.hostname == '': self.hostname = misc.readExternalIP() # bpio.ReadTextFile(settings.ExternalIPFilename()) if self.hostname == '': self.hostname = net_misc.getLocalIp() lg.out(4, 'id_server.doSetUp hostname=%s' % self.hostname) if not os.path.isdir(settings.IdentityServerDir()): os.makedirs(settings.IdentityServerDir()) lg.out(4, ' created a folder %s' % settings.IdentityServerDir()) root = WebRoot() root.putChild('', WebMainPage()) try: self.web_listener = reactor.listenTCP(self.web_port, server.Site(root)) lg.out(4, " have started web listener on port %d " % (self.web_port)) except: lg.out(4, "id_server.set_up ERROR exception trying to listen on port " + str(self.web_port)) lg.exc() try: self.tcp_listener = reactor.listenTCP(self.tcp_port, IdServerFactory()) lg.out(4, " identity server listen on TCP port %d started" % (self.tcp_port)) except: lg.out(4, "id_server.set_up ERROR exception trying to listen on port " + str(self.tcp_port)) lg.exc()