Revision 232144d0 lib/daemon.py
b/lib/daemon.py | ||
---|---|---|
94 | 94 |
|
95 | 95 |
# this method is overriding an asyncore.dispatcher method |
96 | 96 |
def handle_read(self): |
97 |
try: |
|
98 |
payload, address = self.recvfrom(constants.MAX_UDP_DATA_SIZE) |
|
99 |
except socket.error, err: |
|
100 |
if err.errno == errno.EINTR: |
|
101 |
# we got a signal while trying to read. no need to do anything, |
|
102 |
# handle_read will be called again if there is data on the socket. |
|
103 |
return |
|
104 |
else: |
|
105 |
raise |
|
97 |
payload, address = utils.IgnoreSignals(self.recvfrom, |
|
98 |
constants.MAX_UDP_DATA_SIZE) |
|
106 | 99 |
ip, port = address |
107 | 100 |
self.handle_datagram(payload, ip, port) |
108 | 101 |
|
... | ... | |
124 | 117 |
logging.error("handle_write called with empty output queue") |
125 | 118 |
return |
126 | 119 |
(ip, port, payload) = self._out_queue[0] |
127 |
try: |
|
128 |
self.sendto(payload, 0, (ip, port)) |
|
129 |
except socket.error, err: |
|
130 |
if err.errno == errno.EINTR: |
|
131 |
# we got a signal while trying to write. no need to do anything, |
|
132 |
# handle_write will be called again because we haven't emptied the |
|
133 |
# _out_queue, and we'll try again |
|
134 |
return |
|
135 |
else: |
|
136 |
raise |
|
120 |
utils.IgnoreSignals(self.sendto, payload, 0, (ip, port)) |
|
137 | 121 |
self._out_queue.pop(0) |
138 | 122 |
|
139 | 123 |
# this method is overriding an asyncore.dispatcher method |
Also available in: Unified diff