websockets: turn on autoPingInterval to expire stale connections
With this, both clients and servers will send a PING at least once every minute, and will drop connections that haven't seen any traffic for 10 minutes. This should help keep NAT table entries alive, and will drop connections that are no longer viable because their NAT entries have expired. closes #60
This commit is contained in:
parent
fc9a6f7d99
commit
cdb5c19010
|
@ -247,5 +247,6 @@ class WebSocketRendezvousFactory(websocket.WebSocketServerFactory):
|
|||
protocol = WebSocketRendezvous
|
||||
def __init__(self, url, rendezvous):
|
||||
websocket.WebSocketServerFactory.__init__(self, url)
|
||||
self.setProtocolOptions(autoPingInterval=60, autoPingTimeout=600)
|
||||
self.rendezvous = rendezvous
|
||||
self.reactor = reactor # for tests to control
|
||||
|
|
|
@ -354,6 +354,7 @@ class _Wormhole:
|
|||
self._ws_t = self._timing.add("open websocket")
|
||||
p = urlparse(self._ws_url)
|
||||
f = WSFactory(self._ws_url)
|
||||
f.setProtocolOptions(autoPingInterval=60, autoPingTimeout=600)
|
||||
f.wormhole = self
|
||||
f.d = defer.Deferred()
|
||||
# TODO: if hostname="localhost", I get three factories starting
|
||||
|
|
Loading…
Reference in New Issue
Block a user