Enable TCP keepalives

This commit is contained in:
jesopo 2019-05-27 07:58:24 +01:00
parent 2a93a8f1dd
commit 5b780672a8

View file

@ -58,6 +58,7 @@ class Socket(IRCObject.Object):
bindhost = (self._bindhost, 0) bindhost = (self._bindhost, 0)
self._socket = socket.create_connection((self._hostname, self._port), self._socket = socket.create_connection((self._hostname, self._port),
5.0, bindhost) 5.0, bindhost)
self._socket.setsockopt(socket.SOL_SOCKET, socket.SO_KEEPALIVE, 1)
if self._tls: if self._tls:
self._tls_wrap() self._tls_wrap()