[svn] commit: r3062 - /branches/trac299/src/bin/xfrout/xfrout.py.in
BIND 10 source code commits
bind10-changes at lists.isc.org
Wed Sep 29 07:15:33 UTC 2010
Author: chenzhengzhang
Date: Wed Sep 29 07:15:33 2010
New Revision: 3062
Log:
add stop flag for request handling loop
Modified:
branches/trac299/src/bin/xfrout/xfrout.py.in
Modified: branches/trac299/src/bin/xfrout/xfrout.py.in
==============================================================================
--- branches/trac299/src/bin/xfrout/xfrout.py.in (original)
+++ branches/trac299/src/bin/xfrout/xfrout.py.in Wed Sep 29 07:15:33 2010
@@ -67,14 +67,17 @@
class XfroutSession(BaseRequestHandler):
- def __init__(self, request, client_address, server, log):
+ def __init__(self, request, client_address, server, log, runnable):
# The initializer for the superclass may call functions
# that need _log to be set, so we set it first
self._log = log
+ self._runnable = runnable
BaseRequestHandler.__init__(self, request, client_address, server)
def handle(self):
- while True:
+ # Handle a request until shutdown or xfrout client is closed.
+ self._runnable = True
+ while self._runnable:
fd = recv_fd(self.request.fileno())
if fd < 0:
@@ -301,13 +304,14 @@
self._lock = threading.Lock()
self._transfers_counter = 0
self._shutdown_event = shutdown_event
+ self._runnable = False
self._log = log
self.update_config_data(config_data)
self._cc = cc
def finish_request(self, request, client_address):
'''Finish one request by instantiating RequestHandlerClass.'''
- self.RequestHandlerClass(request, client_address, self, self._log)
+ self.RequestHandlerClass(request, client_address, self, self._log, self._runnable)
def _remove_unused_sock_file(self, sock_file):
'''Try to remove the socket file. If the file is being used
@@ -341,6 +345,7 @@
return True
def shutdown(self):
+ self._runnable = False
ThreadingUnixStreamServer.shutdown(self)
try:
os.unlink(self._sock_file)
More information about the bind10-changes
mailing list