1717
1818"""Command-line script that runs a server over roundup.cgi.client.
1919
20- $Id: roundup_server.py,v 1.59 2004-07-27 01:59:28 richard Exp $
20+ $Id: roundup_server.py,v 1.60 2004-09-21 08: 01:15 a1s Exp $
2121"""
2222__docformat__ = 'restructuredtext'
2323
@@ -232,8 +232,7 @@ class server_class(SocketServer.ForkingMixIn, BaseHTTPServer.HTTPServer):
232232 # allow the win32
233233 import win32service
234234 import win32event
235- from win32event import *
236- from win32file import *
235+ import win32file
237236
238237 SvcShutdown = "ServiceShutdown"
239238
@@ -279,25 +278,27 @@ def SvcDoRun(self):
279278
280279 def get_request (self ):
281280 # Call WSAEventSelect to enable self.socket to be waited on.
282- WSAEventSelect (self .socket , self .hevConn , FD_ACCEPT )
281+ win32file .WSAEventSelect (self .socket , self .hevConn ,
282+ win32file .FD_ACCEPT )
283283 while 1 :
284284 try :
285285 rv = self .socket .accept ()
286286 except socket .error , why :
287- if why [0 ] != WSAEWOULDBLOCK :
287+ if why [0 ] != win32file . WSAEWOULDBLOCK :
288288 raise
289289 # Use WaitForMultipleObjects instead of select() because
290290 # on NT select() is only good for sockets, and not general
291291 # NT synchronization objects.
292- rc = WaitForMultipleObjects ((self .hevSvcStop , self .hevConn ),
293- 0 , INFINITE )
294- if rc == WAIT_OBJECT_0 :
292+ rc = win32event .WaitForMultipleObjects (
293+ (self .hevSvcStop , self .hevConn ),
294+ 0 , win32event .INFINITE )
295+ if rc == win32event .WAIT_OBJECT_0 :
295296 # self.hevSvcStop was signaled, this means:
296297 # Stop the service!
297298 # So we throw the shutdown exception, which gets
298299 # caught by self.SvcDoRun
299300 raise SvcShutdown
300- # Otherwise, rc == WAIT_OBJECT_0 + 1 which means
301+ # Otherwise, rc == win32event. WAIT_OBJECT_0 + 1 which means
301302 # self.hevConn was signaled, which means when we call
302303 # self.socket.accept(), we'll have our incoming connection
303304 # socket!
@@ -313,7 +314,7 @@ def get_request(self):
313314 # So if you yank the following line, the setblocking() call
314315 # will be useless. The socket will still be in non-blocking
315316 # mode.
316- WSAEventSelect (rv [0 ], self .hevConn , 0 )
317+ win32file . WSAEventSelect (rv [0 ], self .hevConn , 0 )
317318 rv [0 ].setblocking (1 )
318319 break
319320 return rv
0 commit comments