Commit 0783f6cd authored by Jim Fulton's avatar Jim Fulton

Use a very short loop timeout when testing

To allow test servers to shut down in a timely manner.

Also, some more debug logging.
parent 594c8c9b
......@@ -128,9 +128,9 @@ class Acceptor(asyncore.dispatcher):
else:
logger.info("connect from %s: %s", repr(addr), c)
def loop(self):
def loop(self, timeout=30.0):
try:
asyncore.loop(map=self.socket_map)
asyncore.loop(map=self.socket_map, timeout=timeout)
except Exception:
if not self.__closed:
raise # Unexpected exc
......@@ -142,3 +142,4 @@ class Acceptor(asyncore.dispatcher):
if not self.__closed:
self.__closed = True
asyncore.dispatcher.close(self)
logger.debug("Closed accepter, %s", len(self.socket_map))
......@@ -109,7 +109,7 @@ def runner(config, qin, qout, timeout=None,
qout.put(server.server.acceptor.addr)
logger.debug('ADDRESS SENT')
thread = threading.Thread(
target=server.server.loop,
target=server.server.loop, kwargs=dict(timeout=.2),
name = None if name is None else name + '-server',
)
thread.setDaemon(True)
......@@ -121,6 +121,10 @@ def runner(config, qin, qout, timeout=None,
pass
server.server.close()
thread.join(join_timeout)
if thread.is_alive():
logger.warning("server thread didn't stop")
else:
logger.debug('server thread stopped')
if not keep:
# Try to cleanup storage files
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment