Browse Source

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


git-svn-id: svn://bind10.isc.org/svn/bind10/trunk@2147 e5f2f494-b856-4b98-b285-d166d9295462

Shane Kerr 15 years ago
parent
commit
bba1a4f678
1 changed files with 14 additions and 2 deletions
  1. 14 2
      src/bin/xfrout/xfrout.py.in

+ 14 - 2
src/bin/xfrout/xfrout.py.in

@@ -28,6 +28,7 @@ import os
 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 @@ class UnixSockServer(ThreadingUnixStreamServer):
         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: