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

Side by Side Diff: net/tools/quic/quic_dispatcher.cc

Issue 2740453006: Add QuicStringPiece which is actually StringPiece. (Closed)
Patch Set: fix compile error and rebase Created 3 years, 9 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
« no previous file with comments | « net/tools/quic/quic_client_bin.cc ('k') | net/tools/quic/quic_dispatcher_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/tools/quic/quic_dispatcher.h" 5 #include "net/tools/quic/quic_dispatcher.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "net/quic/core/crypto/quic_random.h" 10 #include "net/quic/core/crypto/quic_random.h"
11 #include "net/quic/core/quic_flags.h" 11 #include "net/quic/core/quic_flags.h"
12 #include "net/quic/core/quic_utils.h" 12 #include "net/quic/core/quic_utils.h"
13 #include "net/quic/platform/api/quic_bug_tracker.h" 13 #include "net/quic/platform/api/quic_bug_tracker.h"
14 #include "net/quic/platform/api/quic_logging.h" 14 #include "net/quic/platform/api/quic_logging.h"
15 #include "net/quic/platform/api/quic_ptr_util.h" 15 #include "net/quic/platform/api/quic_ptr_util.h"
16 #include "net/quic/platform/api/quic_stack_trace.h" 16 #include "net/quic/platform/api/quic_stack_trace.h"
17 #include "net/quic/platform/api/quic_string_piece.h"
17 #include "net/tools/quic/chlo_extractor.h" 18 #include "net/tools/quic/chlo_extractor.h"
18 #include "net/tools/quic/quic_per_connection_packet_writer.h" 19 #include "net/tools/quic/quic_per_connection_packet_writer.h"
19 #include "net/tools/quic/quic_simple_server_session.h" 20 #include "net/tools/quic/quic_simple_server_session.h"
20 #include "net/tools/quic/quic_time_wait_list_manager.h" 21 #include "net/tools/quic/quic_time_wait_list_manager.h"
21 #include "net/tools/quic/stateless_rejector.h" 22 #include "net/tools/quic/stateless_rejector.h"
22 23
23 using base::StringPiece;
24 using std::string; 24 using std::string;
25 25
26 namespace net { 26 namespace net {
27 27
28 typedef QuicBufferedPacketStore::BufferedPacket BufferedPacket; 28 typedef QuicBufferedPacketStore::BufferedPacket BufferedPacket;
29 typedef QuicBufferedPacketStore::BufferedPacketList BufferedPacketList; 29 typedef QuicBufferedPacketStore::BufferedPacketList BufferedPacketList;
30 typedef QuicBufferedPacketStore::EnqueuePacketResult EnqueuePacketResult; 30 typedef QuicBufferedPacketStore::EnqueuePacketResult EnqueuePacketResult;
31 31
32 namespace { 32 namespace {
33 33
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 creator_.Flush(); 106 creator_.Flush();
107 DCHECK_EQ(1u, collector_.packets()->size()); 107 DCHECK_EQ(1u, collector_.packets()->size());
108 time_wait_list_manager_->AddConnectionIdToTimeWait( 108 time_wait_list_manager_->AddConnectionIdToTimeWait(
109 connection_id_, framer_->version(), 109 connection_id_, framer_->version(),
110 /*connection_rejected_statelessly=*/false, collector_.packets()); 110 /*connection_rejected_statelessly=*/false, collector_.packets());
111 } 111 }
112 112
113 // Generates a series of termination packets containing the crypto handshake 113 // Generates a series of termination packets containing the crypto handshake
114 // message |reject|. Adds the connection to time wait list with the 114 // message |reject|. Adds the connection to time wait list with the
115 // generated packets. 115 // generated packets.
116 void RejectConnection(StringPiece reject) { 116 void RejectConnection(QuicStringPiece reject) {
117 struct iovec iovec; 117 struct iovec iovec;
118 iovec.iov_base = const_cast<char*>(reject.data()); 118 iovec.iov_base = const_cast<char*>(reject.data());
119 iovec.iov_len = reject.length(); 119 iovec.iov_len = reject.length();
120 QuicIOVector iov(&iovec, 1, iovec.iov_len); 120 QuicIOVector iov(&iovec, 1, iovec.iov_len);
121 QuicStreamOffset offset = 0; 121 QuicStreamOffset offset = 0;
122 while (offset < iovec.iov_len) { 122 while (offset < iovec.iov_len) {
123 QuicFrame frame; 123 QuicFrame frame;
124 UniqueStreamBuffer data; 124 UniqueStreamBuffer data;
125 if (!creator_.ConsumeData(kCryptoStreamId, iov, offset, offset, 125 if (!creator_.ConsumeData(kCryptoStreamId, iov, offset, offset,
126 /*fin=*/false, 126 /*fin=*/false,
(...skipping 858 matching lines...) Expand 10 before | Expand all | Expand 10 after
985 void QuicDispatcher::DeliverPacketsToSession( 985 void QuicDispatcher::DeliverPacketsToSession(
986 const std::list<BufferedPacket>& packets, 986 const std::list<BufferedPacket>& packets,
987 QuicSession* session) { 987 QuicSession* session) {
988 for (const BufferedPacket& packet : packets) { 988 for (const BufferedPacket& packet : packets) {
989 session->ProcessUdpPacket(packet.server_address, packet.client_address, 989 session->ProcessUdpPacket(packet.server_address, packet.client_address,
990 *(packet.packet)); 990 *(packet.packet));
991 } 991 }
992 } 992 }
993 993
994 } // namespace net 994 } // namespace net
OLDNEW
« no previous file with comments | « net/tools/quic/quic_client_bin.cc ('k') | net/tools/quic/quic_dispatcher_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698