Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(63)

Side by Side Diff: net/quic/quic_connection_test.cc

Issue 340433002: Port QuicServer to Chrome network stack (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address review comments and fix blocked writers using callbacks Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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) OVERRIDE { 291 const IPEndPoint& peer_address,
292 base::Callback<void(WriteResult wr)> callback) OVERRIDE {
292 QuicEncryptedPacket packet(buffer, buf_len); 293 QuicEncryptedPacket packet(buffer, buf_len);
293 ++packets_write_attempts_; 294 ++packets_write_attempts_;
294 295
295 if (packet.length() >= sizeof(final_bytes_of_last_packet_)) { 296 if (packet.length() >= sizeof(final_bytes_of_last_packet_)) {
296 final_bytes_of_previous_packet_ = final_bytes_of_last_packet_; 297 final_bytes_of_previous_packet_ = final_bytes_of_last_packet_;
297 memcpy(&final_bytes_of_last_packet_, packet.data() + packet.length() - 4, 298 memcpy(&final_bytes_of_last_packet_, packet.data() + packet.length() - 4,
298 sizeof(final_bytes_of_last_packet_)); 299 sizeof(final_bytes_of_last_packet_));
299 } 300 }
300 301
301 if (use_tagging_decrypter_) { 302 if (use_tagging_decrypter_) {
(...skipping 3714 matching lines...) Expand 10 before | Expand all | Expand 10 after
4016 QuicBlockedFrame blocked; 4017 QuicBlockedFrame blocked;
4017 blocked.stream_id = 3; 4018 blocked.stream_id = 3;
4018 EXPECT_CALL(visitor_, OnBlockedFrames(_)); 4019 EXPECT_CALL(visitor_, OnBlockedFrames(_));
4019 ProcessFramePacket(QuicFrame(&blocked)); 4020 ProcessFramePacket(QuicFrame(&blocked));
4020 EXPECT_TRUE(ack_alarm->IsSet()); 4021 EXPECT_TRUE(ack_alarm->IsSet());
4021 } 4022 }
4022 4023
4023 } // namespace 4024 } // namespace
4024 } // namespace test 4025 } // namespace test
4025 } // namespace net 4026 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698