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

[minion-cvs] Mark POLLHUP as a failed connection so msgs get retried



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

Modified Files:
	TLSConnection.py 
Log Message:
Mark POLLHUP as a failed connection so msgs get retried

Index: TLSConnection.py
===================================================================
RCS file: /home/minion/cvsroot/src/minion/lib/mixminion/TLSConnection.py,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- TLSConnection.py	22 Jan 2004 05:42:07 -0000	1.6
+++ TLSConnection.py	22 Jan 2004 09:47:34 -0000	1.7
@@ -237,9 +237,15 @@
     #####
     # Implementation
     #####
-    def __close(self):
+    def __close(self, gotClose=0):
         """helper: close the underlying socket without cleaning up the TLS
            connection."""
+        if gotClose:
+            if self.__stateFn == self.__connectFn:
+                LOG.warn("Couldn't connect to %s",self.address)
+            else:
+                LOG.warn("Unexpectedly closed connection to %s", self.address)
+            self.onTLSError()
         self.sock.close()
         self.sock = None
         self.tls = None
@@ -389,9 +395,7 @@
            advance the state of the connection as much as possible.  Return
            is as in 'getStatus'."""
         if x and (self.sock is not None):
-            LOG.warn("Received exception on connection to %s; closing.",
-                     self.address)
-            self.__close()
+            self.__close(gotClose=1)
             return 0,0,0
         elif not (r or w):
             return self.wantRead, self.wantWrite, (self.sock is not None)
@@ -404,12 +408,7 @@
         except _ml.TLSClosed:
             # We get this error if the socket unexpectedly closes underneath
             # the TLS connection.
-            if self.__stateFn == self.__connectFn:
-                LOG.warn("Couldn't connect to %s",self.address)
-            else:
-                LOG.warn("Unexpectedly closed connection to %s", self.address)
-            self.onTLSError()
-            self.__close()
+            self.__close(gotClose=1)
         except _ml.TLSWantRead:
             self.wantRead = 1
             self.wantWrite = 0