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

Unified Diff: sdk/lib/io/websocket_impl.dart

Issue 297653003: Fix websocket status-code for when the close-timer or error cases. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 7 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/io/websocket_impl.dart
diff --git a/sdk/lib/io/websocket_impl.dart b/sdk/lib/io/websocket_impl.dart
index 3e012108707d1659a5730d71390d0e43c205c5cc..475c8f48248a8ff015d53f77e3bfdeff2989c0d7 100644
--- a/sdk/lib/io/websocket_impl.dart
+++ b/sdk/lib/io/websocket_impl.dart
@@ -865,6 +865,9 @@ class _WebSocketImpl extends Stream implements WebSocket {
} else {
_close(WebSocketStatus.PROTOCOL_ERROR);
}
+ // An error happened, set the close code set above.
+ _closeCode = _outCloseCode;
+ _closeReason = _outCloseReason;
_controller.close();
},
onDone: () {
@@ -878,6 +881,7 @@ class _WebSocketImpl extends Stream implements WebSocket {
}
_readyState = WebSocket.CLOSED;
}
+ // Protocol close, use close code from transformer.
_closeCode = transformer.closeCode;
_closeReason = transformer.closeReason;
_controller.close();
@@ -942,6 +946,9 @@ class _WebSocketImpl extends Stream implements WebSocket {
if (_closeTimer == null && !_controller.isClosed) {
// When closing the web-socket, we no longer accept data.
_closeTimer = new Timer(const Duration(seconds: 5), () {
+ // Reuse code and reason from the local close.
+ _closeCode = _outCloseCode;
+ _closeReason = _outCloseReason;
_subscription.cancel();
_controller.close();
});
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698