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 719 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
730 if (last_header_.packet_number <= largest_seen_packet_with_ack_) { | 730 if (last_header_.packet_number <= largest_seen_packet_with_ack_) { |
731 DVLOG(1) << ENDPOINT << "Received an old ack frame: ignoring"; | 731 DVLOG(1) << ENDPOINT << "Received an old ack frame: ignoring"; |
732 return true; | 732 return true; |
733 } | 733 } |
734 | 734 |
735 if (!ValidateAckFrame(incoming_ack)) { | 735 if (!ValidateAckFrame(incoming_ack)) { |
736 SendConnectionClose(QUIC_INVALID_ACK_DATA); | 736 SendConnectionClose(QUIC_INVALID_ACK_DATA); |
737 return false; | 737 return false; |
738 } | 738 } |
739 | 739 |
| 740 if (FLAGS_quic_respect_send_alarm && |
| 741 send_alarm_->IsSet()) { |
| 742 send_alarm_->Cancel(); |
| 743 } |
740 ProcessAckFrame(incoming_ack); | 744 ProcessAckFrame(incoming_ack); |
741 if (incoming_ack.is_truncated) { | 745 if (incoming_ack.is_truncated) { |
742 should_last_packet_instigate_acks_ = true; | 746 should_last_packet_instigate_acks_ = true; |
743 } | 747 } |
744 // If the peer is still waiting for a packet that we are no longer planning to | 748 // If the peer is still waiting for a packet that we are no longer planning to |
745 // send, send an ack to raise the high water mark. | 749 // send, send an ack to raise the high water mark. |
746 if (!incoming_ack.missing_packets.Empty() && | 750 if (!incoming_ack.missing_packets.Empty() && |
747 GetLeastUnacked() > incoming_ack.missing_packets.Min()) { | 751 GetLeastUnacked() > incoming_ack.missing_packets.Min()) { |
748 ++stop_waiting_count_; | 752 ++stop_waiting_count_; |
749 } else { | 753 } else { |
(...skipping 718 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1468 if (!connected_) { | 1472 if (!connected_) { |
1469 return false; | 1473 return false; |
1470 } | 1474 } |
1471 | 1475 |
1472 if (writer_->IsWriteBlocked()) { | 1476 if (writer_->IsWriteBlocked()) { |
1473 visitor_->OnWriteBlocked(); | 1477 visitor_->OnWriteBlocked(); |
1474 return false; | 1478 return false; |
1475 } | 1479 } |
1476 | 1480 |
1477 // If the send alarm is set, wait for it to fire. | 1481 // If the send alarm is set, wait for it to fire. |
1478 if (FLAGS_respect_send_alarm && send_alarm_->IsSet()) { | 1482 if (FLAGS_quic_respect_send_alarm && |
| 1483 send_alarm_->IsSet()) { |
1479 return false; | 1484 return false; |
1480 } | 1485 } |
1481 | 1486 |
1482 QuicTime now = clock_->Now(); | 1487 QuicTime now = clock_->Now(); |
1483 QuicTime::Delta delay = sent_packet_manager_.TimeUntilSend( | 1488 QuicTime::Delta delay = sent_packet_manager_.TimeUntilSend( |
1484 now, retransmittable); | 1489 now, retransmittable); |
1485 if (delay.IsInfinite()) { | 1490 if (delay.IsInfinite()) { |
1486 send_alarm_->Cancel(); | 1491 send_alarm_->Cancel(); |
1487 return false; | 1492 return false; |
1488 } | 1493 } |
1489 | 1494 |
1490 // If the scheduler requires a delay, then we can not send this packet now. | 1495 // If the scheduler requires a delay, then we can not send this packet now. |
1491 if (!delay.IsZero()) { | 1496 if (!delay.IsZero()) { |
1492 send_alarm_->Update(now.Add(delay), QuicTime::Delta::FromMilliseconds(1)); | 1497 send_alarm_->Update(now.Add(delay), QuicTime::Delta::FromMilliseconds(1)); |
1493 DVLOG(1) << ENDPOINT << "Delaying sending " << delay.ToMilliseconds() | 1498 DVLOG(1) << ENDPOINT << "Delaying sending " << delay.ToMilliseconds() |
1494 << "ms"; | 1499 << "ms"; |
1495 return false; | 1500 return false; |
1496 } | 1501 } |
1497 if (!FLAGS_respect_send_alarm) { | 1502 if (!FLAGS_quic_respect_send_alarm) { |
1498 send_alarm_->Cancel(); | 1503 send_alarm_->Cancel(); |
1499 } | 1504 } |
1500 return true; | 1505 return true; |
1501 } | 1506 } |
1502 | 1507 |
1503 bool QuicConnection::WritePacket(QueuedPacket* packet) { | 1508 bool QuicConnection::WritePacket(QueuedPacket* packet) { |
1504 if (!WritePacketInner(packet)) { | 1509 if (!WritePacketInner(packet)) { |
1505 return false; | 1510 return false; |
1506 } | 1511 } |
1507 delete packet->serialized_packet.retransmittable_frames; | 1512 delete packet->serialized_packet.retransmittable_frames; |
(...skipping 843 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2351 packet_number_of_last_sent_packet_ + packets_between_mtu_probes_ + 1; | 2356 packet_number_of_last_sent_packet_ + packets_between_mtu_probes_ + 1; |
2352 ++mtu_probe_count_; | 2357 ++mtu_probe_count_; |
2353 | 2358 |
2354 DVLOG(2) << "Sending a path MTU discovery packet #" << mtu_probe_count_; | 2359 DVLOG(2) << "Sending a path MTU discovery packet #" << mtu_probe_count_; |
2355 SendMtuDiscoveryPacket(mtu_discovery_target_); | 2360 SendMtuDiscoveryPacket(mtu_discovery_target_); |
2356 | 2361 |
2357 DCHECK(!mtu_discovery_alarm_->IsSet()); | 2362 DCHECK(!mtu_discovery_alarm_->IsSet()); |
2358 } | 2363 } |
2359 | 2364 |
2360 } // namespace net | 2365 } // namespace net |
OLD | NEW |