Revision d8bcfe21 lib/daemon.py
b/lib/daemon.py | ||
---|---|---|
310 | 310 |
"""An improved asyncore udp socket. |
311 | 311 |
|
312 | 312 |
""" |
313 |
def __init__(self): |
|
313 |
def __init__(self, family):
|
|
314 | 314 |
"""Constructor for AsyncUDPSocket |
315 | 315 |
|
316 | 316 |
""" |
317 | 317 |
GanetiBaseAsyncoreDispatcher.__init__(self) |
318 | 318 |
self._out_queue = [] |
319 |
self.create_socket(socket.AF_INET, socket.SOCK_DGRAM) |
|
319 |
self._family = family |
|
320 |
self.create_socket(family, socket.SOCK_DGRAM) |
|
320 | 321 |
|
321 | 322 |
# this method is overriding an asyncore.dispatcher method |
322 | 323 |
def handle_connect(self): |
... | ... | |
331 | 332 |
constants.MAX_UDP_DATA_SIZE) |
332 | 333 |
if recv_result is not None: |
333 | 334 |
payload, address = recv_result |
334 |
ip, port = address |
|
335 |
if self._family == socket.AF_INET6: |
|
336 |
# we ignore 'flow info' and 'scope id' as we don't need them |
|
337 |
ip, port, _, _ = address |
|
338 |
else: |
|
339 |
ip, port = address |
|
340 |
|
|
335 | 341 |
self.handle_datagram(payload, ip, port) |
336 | 342 |
|
337 | 343 |
def handle_datagram(self, payload, ip, port): |
Also available in: Unified diff