| 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 1424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1435 DVLOG(1) << ENDPOINT << "time of last sent packet: " | 1435 DVLOG(1) << ENDPOINT << "time of last sent packet: " |
| 1436 << now.ToDebuggingValue(); | 1436 << now.ToDebuggingValue(); |
| 1437 | 1437 |
| 1438 // TODO(ianswett): Change the sequence number length and other packet creator | 1438 // TODO(ianswett): Change the sequence number length and other packet creator |
| 1439 // options by a more explicit API than setting a struct value directly, | 1439 // options by a more explicit API than setting a struct value directly, |
| 1440 // perhaps via the NetworkChangeVisitor. | 1440 // perhaps via the NetworkChangeVisitor. |
| 1441 packet_generator_.UpdateSequenceNumberLength( | 1441 packet_generator_.UpdateSequenceNumberLength( |
| 1442 sent_packet_manager_.least_packet_awaited_by_peer(), | 1442 sent_packet_manager_.least_packet_awaited_by_peer(), |
| 1443 sent_packet_manager_.GetCongestionWindow()); | 1443 sent_packet_manager_.GetCongestionWindow()); |
| 1444 | 1444 |
| 1445 if (packet->original_sequence_number == 0) { | 1445 if (packet->original_sequence_number != 0 && debug_visitor_.get() != NULL) { |
| 1446 sent_packet_manager_.OnSerializedPacket(packet->serialized_packet); | 1446 debug_visitor_->OnPacketRetransmitted( |
| 1447 } else { | 1447 packet->original_sequence_number, sequence_number); |
| 1448 if (debug_visitor_.get() != NULL) { | |
| 1449 debug_visitor_->OnPacketRetransmitted( | |
| 1450 packet->original_sequence_number, sequence_number); | |
| 1451 } | |
| 1452 sent_packet_manager_.OnRetransmittedPacket(packet->original_sequence_number, | |
| 1453 sequence_number); | |
| 1454 } | 1448 } |
| 1455 bool reset_retransmission_alarm = sent_packet_manager_.OnPacketSent( | 1449 bool reset_retransmission_alarm = sent_packet_manager_.OnPacketSent( |
| 1456 sequence_number, | 1450 &packet->serialized_packet, |
| 1451 packet->original_sequence_number, |
| 1457 now, | 1452 now, |
| 1458 encrypted->length(), | 1453 encrypted->length(), |
| 1459 packet->transmission_type, | 1454 packet->transmission_type, |
| 1460 IsRetransmittable(*packet)); | 1455 IsRetransmittable(*packet)); |
| 1461 // The SentPacketManager now owns the retransmittable frames. | |
| 1462 packet->serialized_packet.retransmittable_frames = NULL; | |
| 1463 | 1456 |
| 1464 if (reset_retransmission_alarm || !retransmission_alarm_->IsSet()) { | 1457 if (reset_retransmission_alarm || !retransmission_alarm_->IsSet()) { |
| 1465 retransmission_alarm_->Update(sent_packet_manager_.GetRetransmissionTime(), | 1458 retransmission_alarm_->Update(sent_packet_manager_.GetRetransmissionTime(), |
| 1466 QuicTime::Delta::FromMilliseconds(1)); | 1459 QuicTime::Delta::FromMilliseconds(1)); |
| 1467 } | 1460 } |
| 1468 | 1461 |
| 1469 stats_.bytes_sent += result.bytes_written; | 1462 stats_.bytes_sent += result.bytes_written; |
| 1470 ++stats_.packets_sent; | 1463 ++stats_.packets_sent; |
| 1471 if (packet->transmission_type != NOT_RETRANSMISSION) { | 1464 if (packet->transmission_type != NOT_RETRANSMISSION) { |
| 1472 stats_.bytes_retransmitted += result.bytes_written; | 1465 stats_.bytes_retransmitted += result.bytes_written; |
| (...skipping 559 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2032 } | 2025 } |
| 2033 for (size_t i = 0; i < retransmittable_frames->frames().size(); ++i) { | 2026 for (size_t i = 0; i < retransmittable_frames->frames().size(); ++i) { |
| 2034 if (retransmittable_frames->frames()[i].type == CONNECTION_CLOSE_FRAME) { | 2027 if (retransmittable_frames->frames()[i].type == CONNECTION_CLOSE_FRAME) { |
| 2035 return true; | 2028 return true; |
| 2036 } | 2029 } |
| 2037 } | 2030 } |
| 2038 return false; | 2031 return false; |
| 2039 } | 2032 } |
| 2040 | 2033 |
| 2041 } // namespace net | 2034 } // namespace net |
| OLD | NEW |