respdiff/sendrecv: handle failed TLS handshake
When respdiff attempts to establish TLS connection shortly after resolver startup, the following error often happens:
Traceback (most recent call last):
File "/usr/lib/python3.6/multiprocessing/pool.py", line 119, in worker
result = (True, func(*args, **kwds))
File "/var/opt/respdiff/respdiff/sendrecv.py", line 134, in worker_perform_single_query
worker_reinit()
File "/var/opt/respdiff/respdiff/sendrecv.py", line 89, in worker_reinit
selector, sockets = sock_init() # type: Tuple[Selector, ResolverSockets]
File "/var/opt/respdiff/respdiff/sendrecv.py", line 195, in sock_init
sock.connect(destination)
File "/usr/lib/python3.6/ssl.py", line 1100, in connect
self._real_connect(addr, False)
File "/usr/lib/python3.6/ssl.py", line 1091, in _real_connect
self.do_handshake()
File "/usr/lib/python3.6/ssl.py", line 1068, in do_handshake
self._sslobj.do_handshake()
File "/usr/lib/python3.6/ssl.py", line 689, in do_handshake
self._sslobj.do_handshake()
OSError: [Errno 0] Error
I added a timeout-retry mechanic for these cases. Currently testing if it helps to resolve the issue.
Edited by Tomas Krizek