[svn] commit: r2147 - /trunk/src/bin/xfrout/xfrout.py.in

BIND 10 source code commits bind10-changes at lists.isc.org
Thu Jun 17 12:08:42 UTC 2010


Author: shane
Date: Thu Jun 17 12:08:41 2010
New Revision: 2147

Log:
Ctrl-C was causing xfrout to get an exception. This was serve_forever() 
using select(), and getting EINTR on the system call.

This patch fixes that.

See Trac #146 for the full history:

  http://bind10.isc.org/ticket/146

Modified:
    trunk/src/bin/xfrout/xfrout.py.in

Modified: trunk/src/bin/xfrout/xfrout.py.in
==============================================================================
--- trunk/src/bin/xfrout/xfrout.py.in (original)
+++ trunk/src/bin/xfrout/xfrout.py.in Thu Jun 17 12:08:41 2010
@@ -28,6 +28,7 @@
 from isc.config.ccsession import *
 from isc.cc import SessionError
 import socket
+import select
 import errno
 from optparse import OptionParser, OptionValueError
 try:
@@ -363,11 +364,22 @@
         self._lock.release()
 
 def listen_on_xfr_query(unix_socket_server):
-
     '''Listen xfr query in one single thread. Polls for shutdown 
     every 0.1 seconds, is there a better time?
     '''
-    unix_socket_server.serve_forever(poll_interval = 0.1)
+
+    while True:
+        try:
+            unix_socket_server.serve_forever(poll_interval = 0.1)
+        except select.error as err:
+            # serve_forever() calls select.select(), which can be 
+            # interrupted.
+            # If it is interrupted, it raises select.error with the 
+            # errno set to EINTR. We ignore this case, and let the
+            # normal program flow continue by trying serve_forever()
+            # again.
+            if err.args[0] != errno.EINTR: raise
+
    
 
 class XfroutServer:




More information about the bind10-changes mailing list