[Spambayes-checkins] spambayes/spambayes Dibbler.py,1.4,1.5
Richie Hindle
richiehindle at users.sourceforge.net
Sat Aug 30 20:09:42 EDT 2003
Update of /cvsroot/spambayes/spambayes/spambayes
In directory sc8-pr-cvs1:/tmp/cvs-serv23169
Modified Files:
Dibbler.py
Log Message:
While waiting for existing connections to complete during shutdown,
don't accept any more incoming connections.
Index: Dibbler.py
===================================================================
RCS file: /cvsroot/spambayes/spambayes/spambayes/Dibbler.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** Dibbler.py 30 Aug 2003 23:39:32 -0000 1.4
--- Dibbler.py 31 Aug 2003 02:09:40 -0000 1.5
***************
*** 410,426 ****
eType, eValue, eTrace = sys.exc_info()
if eType == SystemExit:
# Let any existing connections close down first. This
! # has happened when all we have left are Listeners and
! # _HTTPHandlers (including this one and any others
! # that are using keep-alive; no others can be actually
! # doing any work because *we're* the one doing the
! # work).
def isProtected(dispatcher):
! return not (isinstance(dispatcher, Listener) or
! isinstance(dispatcher, _HTTPHandler))
! map = self._context._map
! while len(filter(isProtected, map.values())) > 0:
! asyncore.poll(timeout=1, map=map)
raise SystemExit
--- 410,430 ----
eType, eValue, eTrace = sys.exc_info()
if eType == SystemExit:
+ # Close all the listeners so that no further incoming
+ # connections appear.
+ contextMap = self._context._map
+ for dispatcher in contextMap.values():
+ if isinstance(dispatcher, Listener):
+ dispatcher.close()
+
# Let any existing connections close down first. This
! # has happened when all we have left are _HTTPHandlers
! # (this one plus any others that are using keep-alive;
! # none of the others can be actually doing any work
! # because *we're* the one doing the work).
def isProtected(dispatcher):
! return not isinstance(dispatcher, _HTTPHandler)
! while len(filter(isProtected, contextMap.values())) > 0:
! asyncore.poll(timeout=1, map=contextMap)
raise SystemExit
More information about the Spambayes-checkins
mailing list