[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[minion-cvs] Needlessly short selects sleep furiously."
Update of /home/minion/cvsroot/src/minion/lib/mixminion/server
In directory moria.mit.edu:/tmp/cvs-serv4343/lib/mixminion/server
Modified Files:
ServerMain.py
Log Message:
"Needlessly short selects sleep furiously."
(apologies to Noam Chomsky)
Index: ServerMain.py
===================================================================
RCS file: /home/minion/cvsroot/src/minion/lib/mixminion/server/ServerMain.py,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- ServerMain.py 20 Dec 2002 23:52:07 -0000 1.8
+++ ServerMain.py 21 Dec 2002 00:18:49 -0000 1.9
@@ -281,7 +281,8 @@
def run(self):
"""Run the server; don't return unless we hit an exception."""
# FFFF Use heapq to schedule events? [I don't think so; there are only
- # FFFF two events, after all!]
+ # FFFF two events, after all!] [But the intervals may be very
+ # FFFF different...!]
f = open(self.pidFile, 'wt')
f.write("%s\n" % os.getpid())
@@ -296,14 +297,17 @@
#nextRotate = self.keyring.getNextKeyRotation()
while 1:
LOG.trace("Next mix at %s", formatTime(nextMix,1))
- while time.time() < nextMix:
+ timeLeft = 1
+ while timeLeft > 0:
# Handle pending network events
- self.mmtpServer.process(1)
+ self.mmtpServer.process(timeLeft)
# Process any new messages that have come in, placing them
# into the mix pool.
self.incomingQueue.sendReadyMessages()
# Prevent child processes from turning into zombies.
waitForChildren(1)
+ # Calculate remaining time.
+ timeLeft = nextMix - time.time()
# Before we mix, we need to log the hashes to avoid replays.
# FFFF We need to recover on server failure.