[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[minion-cvs] Stop confusing SSL_write: it doesn"t change lengths gra...
Update of /home/minion/cvsroot/src/minion/lib/mixminion
In directory moria.mit.edu:/tmp/cvs-serv8863/lib/mixminion
Modified Files:
TLSConnection.py
Log Message:
Stop confusing SSL_write: it doesn't change lengths gracefully.
Index: TLSConnection.py
===================================================================
RCS file: /home/minion/cvsroot/src/minion/lib/mixminion/TLSConnection.py,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- TLSConnection.py 7 Feb 2004 08:58:53 -0000 1.11
+++ TLSConnection.py 7 Feb 2004 17:11:30 -0000 1.12
@@ -70,6 +70,8 @@
self.__setup = 0
self.__reading = 0
+ self.__blockedWriteLen = 0
+
self.inbuf = []
self.inbuflen = 0
self.outbuf = []
@@ -339,19 +341,26 @@
"Helper function: write as much data from self.outbuf as we can."
self.__writeBlockedOnRead = 0
while self.outbuf and cap > 0:
+ if self.__blockedWriteLen: #DOCDOC
+ span = self.__blockedWriteLen
+ else:
+ span = min(len(self.outbuf[0]),cap)
try:
- n = self.tls.write(self.outbuf[0][:cap])
+ n = self.tls.write(self.outbuf[0][:span])
except _ml.TLSWantRead:
+ self.__blockedWriteLen = span
self.__writeBlockedOnRead = 1
self.wantWrite = 0
self.wantRead = 1
return cap
except _ml.TLSWantWrite:
+ self.__blockedWriteLen = span
self.wantWrite = 1
return cap
else:
# We wrote some data: remove it from the buffer.
assert n >= 0
+ self.__blockedWriteLen = 0
LOG.trace("Wrote %s bytes to %s", n, self.address)
if n == len(self.outbuf[0]):
del self.outbuf[0]