Commit e3c42494 authored by Julien Muchembled's avatar Julien Muchembled

logging: higher severity for UDP errors other than ENETUNREACH

ENETUNREACH is the only error I've ever seen since the beginning of the project.
parent 4536d8eb
import logging, os, random, socket, subprocess, time, weakref
import errno, logging, os, random, socket, subprocess, time, weakref
from collections import defaultdict, deque
from . import ctl, plib, utils, version
......@@ -510,14 +510,16 @@ class TunnelManager(object):
try:
return self.sock.sendto(msg, (ip, PORT))
except socket.error, e:
logging.info('Failed to send message to %s/%s (%s)',
(logging.info if e.errno == errno.ENETUNREACH else logging.error)(
'Failed to send message to %s/%s (%s)',
int(peer, 2), len(peer), e)
def _sendto(self, to, msg):
try:
return self.sock.sendto(msg, to[:2])
except socket.error, e:
logging.info('Failed to send message to %s (%s)', to, e)
(logging.info if e.errno == errno.ENETUNREACH else logging.error)(
'Failed to send message to %s (%s)', to, e)
def handlePeerEvent(self):
msg, address = self.sock.recvfrom(1<<16)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment