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

[minion-cvs] Catch TLS errors that should never ever occur



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

Modified Files:
	MMTPClient.py 
Log Message:
Catch TLS errors that should never ever occur

Index: MMTPClient.py
===================================================================
RCS file: /home/minion/cvsroot/src/minion/lib/mixminion/MMTPClient.py,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -d -r1.39 -r1.40
--- MMTPClient.py	19 Oct 2003 03:12:02 -0000	1.39
+++ MMTPClient.py	20 Oct 2003 18:19:56 -0000	1.40
@@ -64,7 +64,8 @@
            errors."""
         try:
             self._connect(connectTimeout)
-        except (socket.error, _ml.TLSError, _ml.TLSClosed), e:
+        except (socket.error, _ml.TLSError, _ml.TLSClosed,
+                _ml.TLSWantRead, _ml.TLSWantWrite), e:
             self._raise(e, "connecting")
 
     def _raise(self, err, action):
@@ -77,6 +78,10 @@
             tp = "TLS"
         elif isinstance(err, _ml.TLSClosed):
             tp = "TLSClosed"
+        elif isinstance(err, _ml.TLSWantRead):
+            tp = "Unexpected TLSWantRead"
+        elif isinstance(err, _ml.TLSWantWrite):
+            tp = "Unexpected TLSWantWrite"
         else:
             tp = str(type(err))
         e = MixProtocolError("%s error while %s to %s:%s: %s" %(
@@ -177,7 +182,8 @@
                 LOG.warn("Received bad ACK from server")
                 raise MixProtocolError("Bad ACK received")
             LOG.debug("ACK received; packet successfully delivered")
-        except (socket.error, _ml.TLSError, _ml.TLSClosed), e:
+        except (socket.error, _ml.TLSError, _ml.TLSClosed, _ml.TLSWantRead,
+                _ml.TLSWantWrite, _ml.TLSClosed), e:
             self._raise(e, "sending packet")
 
     def shutdown(self):
@@ -189,7 +195,8 @@
                 self.tls.shutdown()
             if self.sock is not None:
                 self.sock.close()
-        except (socket.error, _ml.TLSError, _ml.TLSClosed), e:
+        except (socket.error, _ml.TLSError, _ml.TLSClosed, _ml.TLSWantRead,
+                _ml.TLSWantWrite, _ml.TLSClosed), e:
             self._raise(e, "closing connection")
         LOG.debug("Connection closed")