Skip to content

Commit

Permalink
another fix in the lost connection detection logic
Browse files Browse the repository at this point in the history
  • Loading branch information
miguelgrinberg committed May 8, 2017
1 parent 9a96896 commit 73ac2ea
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions engineio/socket.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,10 @@ def _upgrade_websocket(self, environ, start_response):

def _websocket_handler(self, ws):
"""Engine.IO handler for websocket transport."""
if hasattr(ws, '_sock') and ws._sock is not None: # pragma: no cover
ws._sock.settimeout(self.server.ping_interval)
# try to set a socket timeout matching the configured ping interval
for attr in ['_sock', 'socket']: # pragma: no cover
if hasattr(ws, attr) and hasattr(ws.attr, 'settimeout'):
getattr(ws, attr).settimeout(self.server.ping_interval)

if self.connected:
# the socket was already connected, so this is an upgrade
Expand Down

0 comments on commit 73ac2ea

Please sign in to comment.