mirror of https://git.48k.eu/ogclient
#980 Broken TCP connection times out after 120 seconds through keepalive
Enable TCP keepalive to detect if the ogServer is gone (hard reset). If no reply after 120 seconds, then release the connection to the server.more_events
parent
baa03debd7
commit
8b959c8be9
|
@ -51,6 +51,11 @@ class ogClient:
|
|||
print('connecting...')
|
||||
self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||
self.sock.setblocking(0)
|
||||
self.sock.setsockopt(socket.SOL_SOCKET, socket.SO_KEEPALIVE, 1)
|
||||
self.sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_KEEPIDLE, 60)
|
||||
self.sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_KEEPINTVL, 30)
|
||||
self.sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_KEEPCNT, 4)
|
||||
|
||||
self.state = State.CONNECTING
|
||||
self.data = ""
|
||||
self.trailer = False
|
||||
|
|
Loading…
Reference in New Issue