Reduce logging verbosity for socks.GeneralProxyError
This commit is contained in:
parent
4c63a1be40
commit
b26cf7322d
|
@ -5,6 +5,7 @@ import errno
|
|||
import logging
|
||||
import math
|
||||
import random
|
||||
import re
|
||||
import select
|
||||
import socket
|
||||
import ssl
|
||||
|
@ -163,8 +164,17 @@ class Connection(threading.Thread):
|
|||
except socket.timeout:
|
||||
pass
|
||||
except OSError as e:
|
||||
try: # possible socks.GeneralProxyError
|
||||
e = e.socket_err
|
||||
if isinstance(e, socket.timeout) or (
|
||||
# general failure, unreachable, refused
|
||||
not e.errno and re.match(r'^0x0[1,4,5].*', e.msg)
|
||||
):
|
||||
e.errno = 0
|
||||
except AttributeError:
|
||||
pass
|
||||
# unreachable, refused, no route
|
||||
(logging.info if e.errno not in (101, 111, 113)
|
||||
(logging.info if e.errno not in (0, 101, 111, 113)
|
||||
else logging.debug)(
|
||||
'Connection to %s failed. Reason: %s', peer_str, e)
|
||||
except Exception:
|
||||
|
|
Loading…
Reference in New Issue