Don't break if protocol is removed before it's put into reply_protocols

This commit is contained in:
Andrew Godwin 2017-05-15 09:38:39 -07:00
parent 8787c1dfe2
commit eb195c6004

View File

@ -230,7 +230,8 @@ class WebSocketProtocol(WebSocketServerProtocol):
Call to clean up this socket after it's closed.
"""
if hasattr(self, "reply_channel"):
del self.factory.reply_protocols[self.reply_channel]
if self.reply_channel in self.factory.reply_protocols:
del self.factory.reply_protocols[self.reply_channel]
def duration(self):
"""