Currently if a signal is delivered during an attempted read, an
exception is logged in the logfile. There is no need for this, so we
handle this case explicitely.
Signed-off-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>
import socket
import pyinotify
import time
+import errno
from optparse import OptionParser
# this method is overriding an asyncore.dispatcher method
def handle_read(self):
try:
- payload_in, address = self.recvfrom(4096)
+ try:
+ payload_in, address = self.recvfrom(4096)
+ except socket.error, err:
+ if err.errno == errno.EINTR:
+ # we got a signal while trying to read. no need to do anything,
+ # handle_read will be called again if there is data on the socket.
+ return
+ else:
+ raise
ip, port = address
payload_out = self.processor.ExecQuery(payload_in, ip, port)
if payload_out is not None: