Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions test_websocket.py
Original file line number Diff line number Diff line change
Expand Up @@ -500,3 +500,14 @@ def test_connectionLost(self):
"""
self.request.connectionLost(Failure(CONNECTION_DONE))
self.handler.lostReason.trap(ConnectionDone)

def test_loseConnection_and_connectionLost(self):
"""
L{Request.connectionLost} called after
L{WebSocketTransport.loseConnection} does not cause problems.
"""
self.handler.transport.loseConnection()
# loseConnection() on the transport will disconnect the request, and it
# will get its connectionLost method fired
self.request.connectionLost(Failure(CONNECTION_DONE))
self.assertTrue(self.channel.transport.disconnected)
3 changes: 0 additions & 3 deletions websocket.py
Original file line number Diff line number Diff line change
Expand Up @@ -367,9 +367,6 @@ def loseConnection(self):
Close the connection.
"""
self._request.transport.loseConnection()
del self._request.transport
del self._request
del self._handler

class WebSocketHandler(object):
"""
Expand Down