Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(132)

Unified Diff: net/data/websocket/count-connection_wsh.py

Issue 390773002: [WebSocket] Send a close frame when the renderer process is gone. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/data/websocket/connect_check.html ('k') | net/data/websocket/count_connection.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/data/websocket/count-connection_wsh.py
diff --git a/net/data/websocket/count-connection_wsh.py b/net/data/websocket/count-connection_wsh.py
new file mode 100644
index 0000000000000000000000000000000000000000..aa1659c692fd5ddf186faf98587f8d7244ca70b7
--- /dev/null
+++ b/net/data/websocket/count-connection_wsh.py
@@ -0,0 +1,26 @@
+# Copyright 2014 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+numOpenConnections = 0
+numClosedConnections = 0
+
+
+def web_socket_do_extra_handshake(request):
+ global numOpenConnections
+ numOpenConnections += 1
+
+
+def web_socket_transfer_data(request):
+ request.ws_stream.send_message('open: %d, closed: %d' %
+ (numOpenConnections, numClosedConnections), binary=False)
+ # Just waiting...
+ request.ws_stream.receive_message()
+
+
+def web_socket_passive_closing_handshake(request):
+ global numOpenConnections
+ global numClosedConnections
+ numOpenConnections -= 1
+ numClosedConnections += 1
+ return (1000, '')
« no previous file with comments | « net/data/websocket/connect_check.html ('k') | net/data/websocket/count_connection.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698