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 #include <algorithm> | 9 #include <algorithm> |
10 #include <iterator> | 10 #include <iterator> |
(...skipping 1531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1542 void QuicConnection::UpdateStopWaiting(QuicStopWaitingFrame* stop_waiting) { | 1542 void QuicConnection::UpdateStopWaiting(QuicStopWaitingFrame* stop_waiting) { |
1543 stop_waiting->least_unacked = GetLeastUnacked(); | 1543 stop_waiting->least_unacked = GetLeastUnacked(); |
1544 stop_waiting->entropy_hash = sent_entropy_manager_.GetCumulativeEntropy( | 1544 stop_waiting->entropy_hash = sent_entropy_manager_.GetCumulativeEntropy( |
1545 stop_waiting->least_unacked - 1); | 1545 stop_waiting->least_unacked - 1); |
1546 } | 1546 } |
1547 | 1547 |
1548 void QuicConnection::SendPing() { | 1548 void QuicConnection::SendPing() { |
1549 if (retransmission_alarm_->IsSet()) { | 1549 if (retransmission_alarm_->IsSet()) { |
1550 return; | 1550 return; |
1551 } | 1551 } |
1552 if (version() == QUIC_VERSION_16) { | 1552 packet_generator_.AddControlFrame(QuicFrame(new QuicPingFrame)); |
1553 // TODO(rch): remove this when we remove version 15 and 16. | |
1554 // This is a horrible hideous hack which we should not support. | |
1555 IOVector data; | |
1556 char c_data[] = "C"; | |
1557 data.Append(c_data, 1); | |
1558 QuicConsumedData consumed_data = | |
1559 packet_generator_.ConsumeData(kCryptoStreamId, data, 0, false, | |
1560 MAY_FEC_PROTECT, NULL); | |
1561 if (consumed_data.bytes_consumed == 0) { | |
1562 DLOG(ERROR) << "Unable to send ping!?"; | |
1563 } | |
1564 } else { | |
1565 packet_generator_.AddControlFrame(QuicFrame(new QuicPingFrame)); | |
1566 } | |
1567 } | 1553 } |
1568 | 1554 |
1569 void QuicConnection::SendAck() { | 1555 void QuicConnection::SendAck() { |
1570 ack_alarm_->Cancel(); | 1556 ack_alarm_->Cancel(); |
1571 stop_waiting_count_ = 0; | 1557 stop_waiting_count_ = 0; |
1572 num_packets_received_since_last_ack_sent_ = 0; | 1558 num_packets_received_since_last_ack_sent_ = 0; |
1573 bool send_feedback = false; | 1559 bool send_feedback = false; |
1574 | 1560 |
1575 // Deprecating the Congestion Feedback Frame after QUIC_VERSION_22. | 1561 // Deprecating the Congestion Feedback Frame after QUIC_VERSION_22. |
1576 if (version() <= QUIC_VERSION_22) { | 1562 if (version() <= QUIC_VERSION_22) { |
(...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2021 } | 2007 } |
2022 for (size_t i = 0; i < retransmittable_frames->frames().size(); ++i) { | 2008 for (size_t i = 0; i < retransmittable_frames->frames().size(); ++i) { |
2023 if (retransmittable_frames->frames()[i].type == CONNECTION_CLOSE_FRAME) { | 2009 if (retransmittable_frames->frames()[i].type == CONNECTION_CLOSE_FRAME) { |
2024 return true; | 2010 return true; |
2025 } | 2011 } |
2026 } | 2012 } |
2027 return false; | 2013 return false; |
2028 } | 2014 } |
2029 | 2015 |
2030 } // namespace net | 2016 } // namespace net |
OLD | NEW |