OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "net/websockets/websocket_channel.h" | 5 #include "net/websockets/websocket_channel.h" |
6 | 6 |
7 #include <limits.h> // for INT_MAX | 7 #include <limits.h> // for INT_MAX |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <deque> | 10 #include <deque> |
(...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
458 (state_ == CONNECTED || state_ == SEND_CLOSED || state_ == CLOSE_WAIT); | 458 (state_ == CONNECTED || state_ == SEND_CLOSED || state_ == CLOSE_WAIT); |
459 current_receive_quota_ += base::checked_cast<int>(quota); | 459 current_receive_quota_ += base::checked_cast<int>(quota); |
460 if (start_read) | 460 if (start_read) |
461 AllowUnused(ReadFrames()); | 461 AllowUnused(ReadFrames()); |
462 // |this| may have been deleted. | 462 // |this| may have been deleted. |
463 } | 463 } |
464 | 464 |
465 void WebSocketChannel::StartClosingHandshake(uint16 code, | 465 void WebSocketChannel::StartClosingHandshake(uint16 code, |
466 const std::string& reason) { | 466 const std::string& reason) { |
467 if (InClosingState()) { | 467 if (InClosingState()) { |
| 468 // When the associated renderer process is killed while the channel is in |
| 469 // CLOSING state we reach here. |
468 DVLOG(1) << "StartClosingHandshake called in state " << state_ | 470 DVLOG(1) << "StartClosingHandshake called in state " << state_ |
469 << ". This may be a bug, or a harmless race."; | 471 << ". This may be a bug, or a harmless race."; |
470 return; | 472 return; |
471 } | 473 } |
472 if (state_ == CONNECTING) { | 474 if (state_ == CONNECTING) { |
473 // Abort the in-progress handshake and drop the connection immediately. | 475 // Abort the in-progress handshake and drop the connection immediately. |
474 stream_request_.reset(); | 476 stream_request_.reset(); |
475 SetState(CLOSED); | 477 SetState(CLOSED); |
476 AllowUnused(DoDropChannel(false, kWebSocketErrorAbnormalClosure, "")); | 478 AllowUnused(DoDropChannel(false, kWebSocketErrorAbnormalClosure, "")); |
477 return; | 479 return; |
(...skipping 627 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1105 } | 1107 } |
1106 | 1108 |
1107 void WebSocketChannel::CloseTimeout() { | 1109 void WebSocketChannel::CloseTimeout() { |
1108 stream_->Close(); | 1110 stream_->Close(); |
1109 SetState(CLOSED); | 1111 SetState(CLOSED); |
1110 AllowUnused(DoDropChannel(false, kWebSocketErrorAbnormalClosure, "")); | 1112 AllowUnused(DoDropChannel(false, kWebSocketErrorAbnormalClosure, "")); |
1111 // |this| has been deleted. | 1113 // |this| has been deleted. |
1112 } | 1114 } |
1113 | 1115 |
1114 } // namespace net | 1116 } // namespace net |
OLD | NEW |