Merge pull request #2339 from spikefishjohn/patch-2

Update telnet_server.py
This commit is contained in:
Jeremy Grossmann 2024-01-24 11:53:59 +11:00 committed by GitHub
commit 385fffec56
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -190,6 +190,11 @@ class AsyncioTelnetServer:
sock = network_writer.get_extra_info("socket") sock = network_writer.get_extra_info("socket")
sock.setsockopt(socket.SOL_SOCKET, socket.SO_KEEPALIVE, 1) sock.setsockopt(socket.SOL_SOCKET, socket.SO_KEEPALIVE, 1)
sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1) sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)
# 60 sec keep alives, close tcp session after 4 missed
# Will keep a firewall from aging out telnet console.
writer_sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_KEEPIDLE, 60)
writer_sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_KEEPINTVL, 10)
writer_sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_KEEPCNT, 4)
#log.debug("New connection from {}".format(sock.getpeername())) #log.debug("New connection from {}".format(sock.getpeername()))
# Keep track of connected clients # Keep track of connected clients