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 "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
10 #include "net/base/net_errors.h" | 10 #include "net/base/net_errors.h" |
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
281 final_bytes_of_last_packet_(0), | 281 final_bytes_of_last_packet_(0), |
282 final_bytes_of_previous_packet_(0), | 282 final_bytes_of_previous_packet_(0), |
283 use_tagging_decrypter_(false), | 283 use_tagging_decrypter_(false), |
284 packets_write_attempts_(0) { | 284 packets_write_attempts_(0) { |
285 } | 285 } |
286 | 286 |
287 // QuicPacketWriter interface | 287 // QuicPacketWriter interface |
288 virtual WriteResult WritePacket( | 288 virtual WriteResult WritePacket( |
289 const char* buffer, size_t buf_len, | 289 const char* buffer, size_t buf_len, |
290 const IPAddressNumber& self_address, | 290 const IPAddressNumber& self_address, |
291 const IPEndPoint& peer_address, | 291 const IPEndPoint& peer_address) OVERRIDE { |
292 QuicBlockedWriterInterface* blocked_writer) OVERRIDE { | |
293 QuicEncryptedPacket packet(buffer, buf_len); | 292 QuicEncryptedPacket packet(buffer, buf_len); |
294 ++packets_write_attempts_; | 293 ++packets_write_attempts_; |
295 | 294 |
296 if (packet.length() >= sizeof(final_bytes_of_last_packet_)) { | 295 if (packet.length() >= sizeof(final_bytes_of_last_packet_)) { |
297 final_bytes_of_previous_packet_ = final_bytes_of_last_packet_; | 296 final_bytes_of_previous_packet_ = final_bytes_of_last_packet_; |
298 memcpy(&final_bytes_of_last_packet_, packet.data() + packet.length() - 4, | 297 memcpy(&final_bytes_of_last_packet_, packet.data() + packet.length() - 4, |
299 sizeof(final_bytes_of_last_packet_)); | 298 sizeof(final_bytes_of_last_packet_)); |
300 } | 299 } |
301 | 300 |
302 QuicFramer framer(QuicSupportedVersions(), QuicTime::Zero(), !is_server_); | 301 QuicFramer framer(QuicSupportedVersions(), QuicTime::Zero(), !is_server_); |
(...skipping 3161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3464 true); | 3463 true); |
3465 TestConnection client(guid_, IPEndPoint(), helper_.get(), writer_.get(), | 3464 TestConnection client(guid_, IPEndPoint(), helper_.get(), writer_.get(), |
3466 false); | 3465 false); |
3467 EXPECT_TRUE(client.sent_packet_manager().using_pacing()); | 3466 EXPECT_TRUE(client.sent_packet_manager().using_pacing()); |
3468 EXPECT_FALSE(server.sent_packet_manager().using_pacing()); | 3467 EXPECT_FALSE(server.sent_packet_manager().using_pacing()); |
3469 } | 3468 } |
3470 | 3469 |
3471 } // namespace | 3470 } // namespace |
3472 } // namespace test | 3471 } // namespace test |
3473 } // namespace net | 3472 } // namespace net |
OLD | NEW |