[Spambayes-checkins] spambayes/spambayes Dibbler.py,1.3,1.4

Richie Hindle richiehindle at users.sourceforge.net
Sat Aug 30 17:39:34 EDT 2003


Update of /cvsroot/spambayes/spambayes/spambayes
In directory sc8-pr-cvs1:/tmp/cvs-serv3747

Modified Files:
	Dibbler.py 
Log Message:
The web UI's Shutdown command now waits for any open proxy
connections to finish before exiting the process.  Previously, Shutdown
would just exit, causing the proxied connections to abort.  This paves
the way for pop3proxy_service.py to shut down cleanly as well.


Index: Dibbler.py
===================================================================
RCS file: /cvsroot/spambayes/spambayes/spambayes/Dibbler.py,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** Dibbler.py	29 Jan 2003 03:23:34 -0000	1.3
--- Dibbler.py	30 Aug 2003 23:39:32 -0000	1.4
***************
*** 318,321 ****
--- 318,322 ----
          BrighterAsyncChat.__init__(self, map=context._map)
          BrighterAsyncChat.set_socket(self, clientSocket, context._map)
+         self._context = context
          self._server = server
          self._request = ''
***************
*** 409,414 ****
                      eType, eValue, eTrace = sys.exc_info()
                      if eType == SystemExit:
!                         ##self.shutdown(2)
!                         raise
                      message = """<h3>500 Server error</h3><pre>%s</pre>"""
                      details = traceback.format_exception(eType, eValue, eTrace)
--- 410,429 ----
                      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
!                         
                      message = """<h3>500 Server error</h3><pre>%s</pre>"""
                      details = traceback.format_exception(eType, eValue, eTrace)





More information about the Spambayes-checkins mailing list