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

Unified Diff: net/websockets/websocket_channel.cc

Issue 683113005: Update from chromium https://crrev.com/302282 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years, 2 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/websockets/websocket_channel.h ('k') | sandbox/linux/bpf_dsl/bpf_dsl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/websockets/websocket_channel.cc
diff --git a/net/websockets/websocket_channel.cc b/net/websockets/websocket_channel.cc
index a6eeb1c39100147239879c32f8ee2d18366be2b2..70c080f3c48cc75bf0ec35b0755d542cbb6997eb 100644
--- a/net/websockets/websocket_channel.cc
+++ b/net/websockets/websocket_channel.cc
@@ -297,6 +297,7 @@ WebSocketChannel::WebSocketChannel(
current_send_quota_(0),
current_receive_quota_(0),
timeout_(base::TimeDelta::FromSeconds(kClosingHandshakeTimeoutSeconds)),
+ has_received_close_frame_(false),
received_close_code_(0),
state_(FRESHLY_CONSTRUCTED),
notification_sender_(new HandshakeNotificationSender(this)),
@@ -744,7 +745,7 @@ ChannelState WebSocketChannel::OnReadDone(bool synchronous, int result) {
uint16 code = kWebSocketErrorAbnormalClosure;
std::string reason = "";
bool was_clean = false;
- if (received_close_code_ != 0) {
+ if (has_received_close_frame_) {
code = received_close_code_;
reason = received_close_reason_;
was_clean = (result == ERR_CONNECTION_CLOSED);
@@ -844,6 +845,7 @@ ChannelState WebSocketChannel::HandleFrameByState(
if (event_interface_->OnClosingHandshake() == CHANNEL_DELETED)
return CHANNEL_DELETED;
+ has_received_close_frame_ = true;
received_close_code_ = code;
received_close_reason_ = reason;
break;
@@ -853,6 +855,7 @@ ChannelState WebSocketChannel::HandleFrameByState(
// From RFC6455 section 7.1.5: "Each endpoint
// will see the status code sent by the other end as _The WebSocket
// Connection Close Code_."
+ has_received_close_frame_ = true;
received_close_code_ = code;
received_close_reason_ = reason;
break;
« no previous file with comments | « net/websockets/websocket_channel.h ('k') | sandbox/linux/bpf_dsl/bpf_dsl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698