Added TCP keepalive to telnet and webclient, to make sure to (eventually) catch dead connections. Should help #498, but should test on demo before closing.
This commit is contained in:
parent
b8dfce9cef
commit
263092b4c9
3 changed files with 5 additions and 1 deletions
|
|
@ -50,6 +50,8 @@ class TelnetProtocol(Telnet, StatefulTelnetProtocol, Session):
|
||||||
self.msdp = msdp.Msdp(self)
|
self.msdp = msdp.Msdp(self)
|
||||||
# mxp support
|
# mxp support
|
||||||
self.mxp = Mxp(self)
|
self.mxp = Mxp(self)
|
||||||
|
# keepalive watches for dead links
|
||||||
|
self.transport.setTcpKeepAlive(1)
|
||||||
# add this new connection to sessionhandler so
|
# add this new connection to sessionhandler so
|
||||||
# the Server becomes aware of it.
|
# the Server becomes aware of it.
|
||||||
self.sessionhandler.connect(self)
|
self.sessionhandler.connect(self)
|
||||||
|
|
|
||||||
|
|
@ -46,6 +46,8 @@ class WebSocketClient(Protocol, Session):
|
||||||
"""
|
"""
|
||||||
client_address = self.transport.client
|
client_address = self.transport.client
|
||||||
self.init_session("websocket", client_address, self.factory.sessionhandler)
|
self.init_session("websocket", client_address, self.factory.sessionhandler)
|
||||||
|
# watch for dead links
|
||||||
|
self.transport.setTcpKeepAlive(1)
|
||||||
self.sessionhandler.connect(self)
|
self.sessionhandler.connect(self)
|
||||||
|
|
||||||
def disconnect(self, reason=None):
|
def disconnect(self, reason=None):
|
||||||
|
|
|
||||||
|
|
@ -412,7 +412,7 @@ class ServerSessionHandler(SessionHandler):
|
||||||
def validate_sessions(self):
|
def validate_sessions(self):
|
||||||
"""
|
"""
|
||||||
Check all currently connected sessions (logged in and not)
|
Check all currently connected sessions (logged in and not)
|
||||||
and see if any are dead.
|
and see if any are dead or idle
|
||||||
"""
|
"""
|
||||||
tcurr = time.time()
|
tcurr = time.time()
|
||||||
reason = _("Idle timeout exceeded, disconnecting.")
|
reason = _("Idle timeout exceeded, disconnecting.")
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue