config: a bit more debugging
[hippotat] / hippotatlib / __init__.py
index ab404fa..397dfb2 100644 (file)
@@ -449,12 +449,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 +525,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 +540,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 +699,4 @@ def common_run():
   log_debug(DBG.INIT, 'entering reactor')
   if not _crashing: reactor.run()
   print('ENDED', file=sys.stderr)
+  sys.exit(16)