Skip to content

Commit

Permalink
Do not duplicate SSLSocket instances (Fixes #26)
Browse files Browse the repository at this point in the history
  • Loading branch information
miguelgrinberg committed Aug 13, 2023
1 parent abdfcb0 commit da42e98
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/simple_websocket/ws.py
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,11 @@ def __init__(self, environ, subprotocols=None, receive_bytes=4096,
if not hasattr(wsgi_input, 'raw') and hasattr(wsgi_input, 'rfile'):
wsgi_input = wsgi_input.rfile
if hasattr(wsgi_input, 'raw'):
sock = wsgi_input.raw._sock.dup()
sock = wsgi_input.raw._sock
try:
sock = sock.dup()
except NotImplementedError:
pass
self.mode = 'gevent'
if sock is None:
raise RuntimeError('Cannot obtain socket from WSGI environment.')
Expand Down

0 comments on commit da42e98

Please sign in to comment.