Ticket #146: xfrout-eintr.diff

File xfrout-eintr.diff, 1.1 KB (added by shane, 9 years ago)
  • xfrout.py.in

     
    2828from isc.config.ccsession import *
    2929from isc.cc import SessionError
    3030import socket
     31import select
    3132import errno
    3233from optparse import OptionParser, OptionValueError
    3334try:
     
    363364        self._lock.release()
    364365
    365366def listen_on_xfr_query(unix_socket_server):
    366 
    367367    '''Listen xfr query in one single thread. Polls for shutdown
    368368    every 0.1 seconds, is there a better time?
    369369    '''
    370     unix_socket_server.serve_forever(poll_interval = 0.1)
     370
     371    while True:
     372        try:
     373            unix_socket_server.serve_forever(poll_interval = 0.1)
     374        except select.error as err:
     375            # serve_forever() calls select.select(), which can be
     376            # interrupted.
     377            # If it is interrupted, it raises select.error with the
     378            # errno set to EINTR. We ignore this case, and let the
     379            # normal program flow continue by trying serve_forever()
     380            # again.
     381            if err.args[0] != errno.EINTR: raise
     382
    371383   
    372384
    373385class XfroutServer: