This commit is contained in:
liris
2015-02-19 14:43:23 +09:00
2 changed files with 3 additions and 2 deletions

View File

@@ -110,7 +110,7 @@ class ABNF(object):
raise WebSocketProtocolException("rsv is not implemented, yet")
if self.opcode not in ABNF.OPCODES:
raise WebSocketProtocolException("Invalid opcode " + self.opcode)
raise WebSocketProtocolException("Invalid opcode " + str(self.opcode))
if self.opcode == ABNF.OPCODE_PING and not self.fin:
raise WebSocketProtocolException("Invalid ping frame.")

View File

@@ -948,7 +948,8 @@ class WebSocket(object):
raise
if not bytes:
self.sock.close()
if self.sock:
self.sock.close()
self.sock = None
self.connected = False
raise WebSocketConnectionClosedException()