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 <stddef.h> | 7 #include <stddef.h> |
8 #include <limits.h> // for INT_MAX | 8 #include <limits.h> // for INT_MAX |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 1111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1122 | 1122 |
1123 *code = kWebSocketErrorProtocolError; | 1123 *code = kWebSocketErrorProtocolError; |
1124 *reason = "Invalid UTF-8 in Close frame"; | 1124 *reason = "Invalid UTF-8 in Close frame"; |
1125 *message = "Received a broken close frame containing invalid UTF-8."; | 1125 *message = "Received a broken close frame containing invalid UTF-8."; |
1126 return false; | 1126 return false; |
1127 } | 1127 } |
1128 | 1128 |
1129 ChannelState WebSocketChannel::DoDropChannel(bool was_clean, | 1129 ChannelState WebSocketChannel::DoDropChannel(bool was_clean, |
1130 uint16_t code, | 1130 uint16_t code, |
1131 const std::string& reason) { | 1131 const std::string& reason) { |
| 1132 close_timer_.Stop(); |
1132 if (CHANNEL_DELETED == | 1133 if (CHANNEL_DELETED == |
1133 notification_sender_->SendImmediately(event_interface_.get())) | 1134 notification_sender_->SendImmediately(event_interface_.get())) |
1134 return CHANNEL_DELETED; | 1135 return CHANNEL_DELETED; |
1135 ChannelState result = | 1136 ChannelState result = |
1136 event_interface_->OnDropChannel(was_clean, code, reason); | 1137 event_interface_->OnDropChannel(was_clean, code, reason); |
1137 DCHECK_EQ(CHANNEL_DELETED, result); | |
1138 return result; | 1138 return result; |
1139 } | 1139 } |
1140 | 1140 |
1141 void WebSocketChannel::CloseTimeout() { | 1141 void WebSocketChannel::CloseTimeout() { |
1142 stream_->Close(); | 1142 stream_->Close(); |
1143 SetState(CLOSED); | 1143 SetState(CLOSED); |
1144 DoDropChannel(false, kWebSocketErrorAbnormalClosure, ""); | 1144 DoDropChannel(false, kWebSocketErrorAbnormalClosure, ""); |
1145 // |this| has been deleted. | 1145 // |this| has been deleted. |
1146 } | 1146 } |
1147 | 1147 |
1148 } // namespace net | 1148 } // namespace net |
OLD | NEW |