Tim Peters wrote at 2005-7-25 10:36 -0400:
Yup. ZODB has what looks like a copy/paste of this code, in ZEO/zrpc/trigger.py. I didn't realize where it came from originally until you pointed out the Medusa code here.
Anyway, it so happens I rewrote ZEO's copy a few weeks ago, in ZODB 3.4. The Windows part is much simpler there now. .... After:
# Specifying port 0 tells Windows to pick a port for us. a.bind(("127.0.0.1", 0)) connect_address = a.getsockname() # assigned (host, port) pair a.listen(1) w.connect(connect_address) r, addr = a.accept() # r becomes asyncore's (self.)socket a.close() self.trigger = w
This may even be portable (not Windows specific). At least, it works for Linux2. In this case, we might get rid of the stupid code duplication... -- Dieter