Skip to content
Snippets Groups Projects
Commit 4f16b4a0 authored by Guido Trotter's avatar Guido Trotter
Browse files

ConfdAsyncUDPServer: handle signals at read time


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: default avatarGuido Trotter <ultrotter@google.com>
Reviewed-by: default avatarMichael Hanselmann <hansmi@google.com>
parent 7a0156dc
No related branches found
No related tags found
No related merge requests found
......@@ -33,6 +33,7 @@ import asyncore
import socket
import pyinotify
import time
import errno
from optparse import OptionParser
......@@ -77,7 +78,15 @@ class ConfdAsyncUDPServer(asyncore.dispatcher):
# 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:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment