[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[minion-cvs] Backport fix to maint branch



Update of /home/minion/cvsroot/src/minion/lib/mixminion/server
In directory moria.mit.edu:/tmp/cvs-serv20071/lib/mixminion/server

Modified Files:
      Tag: mixminion-v0-0-5-patches
	MMTPServer.py 
Log Message:
Backport fix to maint branch

Index: MMTPServer.py
===================================================================
RCS file: /home/minion/cvsroot/src/minion/lib/mixminion/server/MMTPServer.py,v
retrieving revision 1.50.2.1
retrieving revision 1.50.2.2
diff -u -d -r1.50.2.1 -r1.50.2.2
--- MMTPServer.py	28 Sep 2003 03:57:33 -0000	1.50.2.1
+++ MMTPServer.py	1 Oct 2003 14:57:54 -0000	1.50.2.2
@@ -1125,14 +1125,16 @@
         try:
             # Is there an existing connection open to the right server?
             con = self.clientConByAddr[(ip,port,keyID)]
-            # If so, is that connection currently sending messages?
+        except KeyError:
+            pass
+        else:
+            # No exception: There is an existing connection.  But is that
+            # connection currently sending messages?
             if con.isActive():
                 LOG.debug("Queueing %s messages on open connection to %s",
                           len(deliverable), con.address)
                 con.addMessages(deliverable)
                 return
-        except KeyError:
-            pass
 
         try:
             # There isn't any connection to the right server. Open one...
@@ -1142,19 +1144,21 @@
                                      ip, port, keyID, deliverable,
                                      finishedCallback=finished,
                                      certCache=self.certificateCache)
-            con.register(self)
-            # ...and register it in clientConByAddr
-            assert addr == con.getAddr()
-            self.clientConByAddr[addr] = con
         except socket.error, e:
             LOG.error("Unexpected socket error connecting to %s:%s: %s",
                       ip, port, e)
             EventStats.log.failedConnect() #FFFF addr
-            for m in con.messageList:
+            for m in deliverable:
                 try:
                     m.failed(1)
                 except AttributeError:
                     pass
+        else:
+            # No exception: We created the connection successfully.  
+            # Thus, register it in clientConByAddr
+            assert addr == con.getAddr()
+            con.register(self)
+            self.clientConByAddr[addr] = con
 
     def __clientFinished(self, addr):
         """Called when a client connection runs out of messages to send."""