X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ian/git?a=blobdiff_plain;f=hippotatlib%2F__init__.py;h=588012a2a845ef40c7c7f1bf2171ff355e4a2b8f;hb=02a201e1e706788f355171ff979e1f82ecadfc71;hp=ab404fab9ac0188e955528e2764bde428eccd1de;hpb=80e963a152d44e4a795d654e8e01a11f64909ed4;p=hippotat.git diff --git a/hippotatlib/__init__.py b/hippotatlib/__init__.py index ab404fa..588012a 100644 --- a/hippotatlib/__init__.py +++ b/hippotatlib/__init__.py @@ -110,7 +110,8 @@ def logevent_is_boringtwisted(event): if dflag is None and DBG.TWISTED in debug_set: return False return True except Exception: - print(traceback.format_exc(), file=org_stderr) + print('EXCEPTION (IN BORINGTWISTED CHECK)', + traceback.format_exc(), file=org_stderr) return False @implementer(twisted.logger.ILogFilterPredicate) @@ -136,22 +137,22 @@ max_batch_up = 4000 http_retry = 5 port = 80 vroutes = '' +ifname_client = hippo%%d +ifname_server = shippo%%d #[server] or [] overrides -ipif = userv root ipif %(local)s,%(peer)s,%(mtu)s,slip %(rnets)s +ipif = userv root ipif %(local)s,%(peer)s,%(mtu)s,slip,%(ifname)s %(rnets)s # relating to virtual network mtu = 1500 -[SERVER] -server = SERVER # addrs = 127.0.0.1 ::1 # url # relating to virtual network vvnetwork = 172.24.230.192 # vnetwork = / -# vadd r = +# vaddr = # vrelay = @@ -449,12 +450,15 @@ def cfg_process_saddrs(c, ss): self._endpointfactory = twisted.internet.endpoints.TCP6ServerEndpoint self._inurl = b'[%s]' def make_endpoint(self): - return self._endpointfactory(reactor, self.port, self.addr) + return self._endpointfactory(reactor, self.port, + interface= '%s' % self.addr) def url(self): url = b'http://' + (self._inurl % str(self.addr).encode('ascii')) if self.port != 80: url += b':%d' % self.port url += b'/' return url + def __repr__(self): + return 'ServerAddr'+repr((self.port,self.addr)) c.port = cfg.getint(ss,'port') c.saddrs = [ ] @@ -522,6 +526,10 @@ def cfg_process_ipif(c, sections, varmap): #---------- startup ---------- +def log_debug_config(m): + if not DBG.CONFIG in debug_set: return + print('DBG.CONFIG:', m) + def common_startup(process_cfg): # calls process_cfg(putative_clients, putative_servers) @@ -533,7 +541,7 @@ def common_startup(process_cfg): def readconfig(pathname, mandatory=True): def log(m, p=pathname): if not DBG.CONFIG in debug_set: return - print('DBG.CONFIG: %s: %s' % (m, pathname)) + log_debug_config('%s: %s' % (m, pathname)) try: files = os.listdir(pathname) @@ -692,3 +700,4 @@ def common_run(): log_debug(DBG.INIT, 'entering reactor') if not _crashing: reactor.run() print('ENDED', file=sys.stderr) + sys.exit(16)