| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/quic/quic_connection.h" | 5 #include "net/quic/quic_connection.h" |
| 6 | 6 |
| 7 #include <string.h> | 7 #include <string.h> |
| 8 #include <sys/types.h> | 8 #include <sys/types.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 317 } | 317 } |
| 318 | 318 |
| 319 void QuicConnection::OnSendConnectionState( | 319 void QuicConnection::OnSendConnectionState( |
| 320 const CachedNetworkParameters& cached_network_params) { | 320 const CachedNetworkParameters& cached_network_params) { |
| 321 if (debug_visitor_ != nullptr) { | 321 if (debug_visitor_ != nullptr) { |
| 322 debug_visitor_->OnSendConnectionState(cached_network_params); | 322 debug_visitor_->OnSendConnectionState(cached_network_params); |
| 323 } | 323 } |
| 324 } | 324 } |
| 325 | 325 |
| 326 bool QuicConnection::ResumeConnectionState( | 326 bool QuicConnection::ResumeConnectionState( |
| 327 const CachedNetworkParameters& cached_network_params) { | 327 const CachedNetworkParameters& cached_network_params, |
| 328 bool max_bandwidth_resumption) { |
| 328 if (debug_visitor_ != nullptr) { | 329 if (debug_visitor_ != nullptr) { |
| 329 debug_visitor_->OnResumeConnectionState(cached_network_params); | 330 debug_visitor_->OnResumeConnectionState(cached_network_params); |
| 330 } | 331 } |
| 331 return sent_packet_manager_.ResumeConnectionState(cached_network_params); | 332 return sent_packet_manager_.ResumeConnectionState(cached_network_params, |
| 333 max_bandwidth_resumption); |
| 332 } | 334 } |
| 333 | 335 |
| 334 void QuicConnection::SetNumOpenStreams(size_t num_streams) { | 336 void QuicConnection::SetNumOpenStreams(size_t num_streams) { |
| 335 sent_packet_manager_.SetNumOpenStreams(num_streams); | 337 sent_packet_manager_.SetNumOpenStreams(num_streams); |
| 336 } | 338 } |
| 337 | 339 |
| 338 bool QuicConnection::SelectMutualVersion( | 340 bool QuicConnection::SelectMutualVersion( |
| 339 const QuicVersionVector& available_versions) { | 341 const QuicVersionVector& available_versions) { |
| 340 // Try to find the highest mutual version by iterating over supported | 342 // Try to find the highest mutual version by iterating over supported |
| 341 // versions, starting with the highest, and breaking out of the loop once we | 343 // versions, starting with the highest, and breaking out of the loop once we |
| (...skipping 1556 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1898 void QuicConnection::CloseConnection(QuicErrorCode error, bool from_peer) { | 1900 void QuicConnection::CloseConnection(QuicErrorCode error, bool from_peer) { |
| 1899 if (!connected_) { | 1901 if (!connected_) { |
| 1900 DLOG(DFATAL) << "Error: attempt to close an already closed connection" | 1902 DLOG(DFATAL) << "Error: attempt to close an already closed connection" |
| 1901 << base::debug::StackTrace().ToString(); | 1903 << base::debug::StackTrace().ToString(); |
| 1902 return; | 1904 return; |
| 1903 } | 1905 } |
| 1904 connected_ = false; | 1906 connected_ = false; |
| 1905 if (debug_visitor_ != nullptr) { | 1907 if (debug_visitor_ != nullptr) { |
| 1906 debug_visitor_->OnConnectionClosed(error, from_peer); | 1908 debug_visitor_->OnConnectionClosed(error, from_peer); |
| 1907 } | 1909 } |
| 1910 DCHECK(visitor_ != nullptr); |
| 1908 visitor_->OnConnectionClosed(error, from_peer); | 1911 visitor_->OnConnectionClosed(error, from_peer); |
| 1909 // Cancel the alarms so they don't trigger any action now that the | 1912 // Cancel the alarms so they don't trigger any action now that the |
| 1910 // connection is closed. | 1913 // connection is closed. |
| 1911 ack_alarm_->Cancel(); | 1914 ack_alarm_->Cancel(); |
| 1912 ping_alarm_->Cancel(); | 1915 ping_alarm_->Cancel(); |
| 1913 fec_alarm_->Cancel(); | 1916 fec_alarm_->Cancel(); |
| 1914 resume_writes_alarm_->Cancel(); | 1917 resume_writes_alarm_->Cancel(); |
| 1915 retransmission_alarm_->Cancel(); | 1918 retransmission_alarm_->Cancel(); |
| 1916 send_alarm_->Cancel(); | 1919 send_alarm_->Cancel(); |
| 1917 timeout_alarm_->Cancel(); | 1920 timeout_alarm_->Cancel(); |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2125 } | 2128 } |
| 2126 for (const QuicFrame& frame : retransmittable_frames->frames()) { | 2129 for (const QuicFrame& frame : retransmittable_frames->frames()) { |
| 2127 if (frame.type == CONNECTION_CLOSE_FRAME) { | 2130 if (frame.type == CONNECTION_CLOSE_FRAME) { |
| 2128 return true; | 2131 return true; |
| 2129 } | 2132 } |
| 2130 } | 2133 } |
| 2131 return false; | 2134 return false; |
| 2132 } | 2135 } |
| 2133 | 2136 |
| 2134 } // namespace net | 2137 } // namespace net |
| OLD | NEW |