[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[minion-cvs] Fix a couple of shallow CPU-eating bugs so that cvs min...
Update of /home/minion/cvsroot/src/minion/lib/mixminion
In directory moria.mit.edu:/tmp/cvs-serv14453/lib/mixminion
Modified Files:
test.py TLSConnection.py MMTPClient.py
Log Message:
Fix a couple of shallow CPU-eating bugs so that cvs minion doesnt eat my CPU anymore
Index: test.py
===================================================================
RCS file: /home/minion/cvsroot/src/minion/lib/mixminion/test.py,v
retrieving revision 1.178
retrieving revision 1.179
diff -u -d -r1.178 -r1.179
--- test.py 17 Jan 2004 04:24:57 -0000 1.178
+++ test.py 22 Jan 2004 05:42:06 -0000 1.179
@@ -7534,7 +7534,7 @@
tc = loader.loadTestsFromTestCase
if 0:
- suite.addTest(tc(ClientUtilTests))
+ suite.addTest(tc(MMTPTests))
return suite
testClasses = [MiscTests,
MinionlibCryptoTests,
Index: TLSConnection.py
===================================================================
RCS file: /home/minion/cvsroot/src/minion/lib/mixminion/TLSConnection.py,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- TLSConnection.py 12 Jan 2004 00:49:00 -0000 1.5
+++ TLSConnection.py 22 Jan 2004 05:42:07 -0000 1.6
@@ -384,11 +384,16 @@
self.__readBlockedOnWrite = 1
return
- def process(self, r, w):
+ def process(self, r, w, x):
"""Given that we've received read/write events as indicated in r/w,
advance the state of the connection as much as possible. Return
is as in 'getStatus'."""
- if not (r or w):
+ if x and (self.sock is not None):
+ LOG.warn("Received exception on connection to %s; closing.",
+ self.address)
+ self.__close()
+ return 0,0,0
+ elif not (r or w):
return self.wantRead, self.wantWrite, (self.sock is not None)
try:
self.lastActivity = time.time()
Index: MMTPClient.py
===================================================================
RCS file: /home/minion/cvsroot/src/minion/lib/mixminion/MMTPClient.py,v
retrieving revision 1.49
retrieving revision 1.50
diff -u -d -r1.49 -r1.50
--- MMTPClient.py 12 Jan 2004 00:49:00 -0000 1.49
+++ MMTPClient.py 22 Jan 2004 05:42:07 -0000 1.50
@@ -98,6 +98,7 @@
self.targetAddr = targetAddr
self.targetPort = targetPort
sock = socket.socket(targetFamily, socket.SOCK_STREAM)
+ serverName += " (fd %s)"%sock.fileno()
sock.setblocking(0)
try:
sock.connect((targetAddr, targetPort))
@@ -108,7 +109,8 @@
raise e
tls = context.sock(sock)
- mixminion.TLSConnection.TLSConnection.__init__(self, tls, sock, serverName)
+ mixminion.TLSConnection.TLSConnection.__init__(self, tls, sock,
+ serverName)
if targetKeyID != '\x00' * 20:
self.targetKeyID = targetKeyID
@@ -446,7 +448,7 @@
rfds,wfds,xfds=select.select(rfds,wfds,xfds,3)
now = time.time()
- wr,ww,isopen=con.process(fd in rfds, fd in wfds)
+ wr,ww,isopen=con.process(fd in rfds, fd in wfds, 0)
if isopen:
if con.tryTimeout(now-timeout):
isopen = 0