Jeffrey Gelens committed 544798b

Fixed an infinite closing bug

Comments (0)

Files changed (1)


 MSG_SOCKET_DEAD = "Socket is dead"
 MSG_ALREADY_CLOSED = "Connection is already closed"
+MSG_CLOSED = "Connection closed"
 class WebSocket(object):
         except ProtocolError:
         except error:
-            self.current_app.on_close(MSG_SOCKET_DEAD)
+            self.close()
+            self.current_app.on_close(MSG_CLOSED)
-            return None
+        return None
     def send_frame(self, message, opcode):
             self.raw_write(header + message)
         except error:
-            raise WebSocketError("Socket is dead")
+            raise WebSocketError(MSG_SOCKET_DEAD)
     def send(self, message, binary=None):
             self.environ = None
-            self.current_app.on_close("Connection closed")
+            self.current_app.on_close(MSG_ALREADY_CLOSED)
 class Stream(object):
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.