Commit bba1a4f6 authored by Shane Kerr's avatar Shane Kerr
Browse files

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
parent 6b6d6659
...@@ -28,6 +28,7 @@ import os ...@@ -28,6 +28,7 @@ import os
from isc.config.ccsession import * from isc.config.ccsession import *
from isc.cc import SessionError from isc.cc import SessionError
import socket import socket
import select
import errno import errno
from optparse import OptionParser, OptionValueError from optparse import OptionParser, OptionValueError
try: try:
...@@ -363,11 +364,22 @@ class UnixSockServer(ThreadingUnixStreamServer): ...@@ -363,11 +364,22 @@ class UnixSockServer(ThreadingUnixStreamServer):
self._lock.release() self._lock.release()
def listen_on_xfr_query(unix_socket_server): def listen_on_xfr_query(unix_socket_server):
'''Listen xfr query in one single thread. Polls for shutdown '''Listen xfr query in one single thread. Polls for shutdown
every 0.1 seconds, is there a better time? 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: class XfroutServer:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment