[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[minion-cvs] Resolve remaining item from nonblocking win32 IO diffe...
Update of /home/minion/cvsroot/src/minion/lib/mixminion/server
In directory moria.mit.edu:/tmp/cvs-serv8888/lib/mixminion/server
Modified Files:
MMTPServer.py
Log Message:
Resolve remaining item from nonblocking win32 IO differences list
Index: MMTPServer.py
===================================================================
RCS file: /home/minion/cvsroot/src/minion/lib/mixminion/server/MMTPServer.py,v
retrieving revision 1.60
retrieving revision 1.61
diff -u -d -r1.60 -r1.61
--- MMTPServer.py 28 Nov 2003 04:14:04 -0000 1.60
+++ MMTPServer.py 8 Dec 2003 04:55:43 -0000 1.61
@@ -23,6 +23,7 @@
import socket
import select
import re
+import sys
import time
from types import StringType
@@ -58,6 +59,7 @@
self.writers = {}
self.readers = {}
self._timeout = None
+ self.wrExceptions = {}
def process(self, timeout):
"""If any relevant file descriptors become available within
@@ -70,7 +72,7 @@
readfds = self.readers.keys()
writefds = self.writers.keys()
-
+ exfds = self.wrExceptions.keys()
if not (readfds or writefds):
# Windows 'select' doesn't timeout properly when we aren't
# selecting on any FDs. This should never happen to us,
@@ -79,7 +81,8 @@
return
try:
- readfds,writefds,exfds = select.select(readfds,writefds,[],timeout)
+ readfds,writefds,exfds = select.select(readfds,writefds,exfds,
+ timeout)
except select.error, e:
if e[0] == errno.EINTR:
return
@@ -91,8 +94,10 @@
for fd in writefds:
self.writers[fd].handleWrite()
for fd in exfds:
- if self.readers.has_key(fd): del self.readers[fd]
- if self.writers.has_key(fd): del self.writers[fd]
+ #DOCDOC -- for win32 connects.
+ self.wrExceptions[fd].handleWrite()
+ #if self.readers.has_key(fd): del self.readers[fd]
+ #if self.writers.has_key(fd): del self.writers[fd]
def hasReader(self, reader):
"""Return true iff 'reader' is a reader on this server."""
@@ -111,13 +116,18 @@
self.readers[fd] = reader
if self.writers.has_key(fd):
del self.writers[fd]
+ if self.wrExceptions.has_key(fd):
+ del self.wrExceptions[fd]
- def registerWriter(self, writer):
+ def registerWriter(self, writer, connecting=0):
"""Register a connection as a writer. The connection's 'handleWrite'
method will be called whenever the buffer is free for writing.
"""
fd = writer.fileno()
self.writers[fd] = writer
+ if connecting and sys.platform == 'win32':
+ #DOCDOC
+ self.wrExceptions[fd] = writer
if self.readers.has_key(fd):
del self.readers[fd]
@@ -301,7 +311,7 @@
server.registerReader(self)
else:
assert self.__state == self.__connectFn
- server.registerWriter(self)
+ server.registerWriter(self, connecting=1)
def expectRead(self, bytes=None, terminator=None):
"""Begin reading from the underlying TLS connection.