Merge pull request #150 from coolyuyuyu/master

BUG FIX
This commit is contained in:
liris
2015-02-16 07:57:15 +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") raise WebSocketProtocolException("rsv is not implemented, yet")
if self.opcode not in ABNF.OPCODES: 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: if self.opcode == ABNF.OPCODE_PING and not self.fin:
raise WebSocketProtocolException("Invalid ping frame.") raise WebSocketProtocolException("Invalid ping frame.")

View File

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