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

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

Issue 786123002: Update from https://crrev.com/307330 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years 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.h ('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_client.h" 5 #include "net/tools/quic/quic_client.h"
6 6
7 #include <errno.h> 7 #include <errno.h>
8 #include <netinet/in.h> 8 #include <netinet/in.h>
9 #include <string.h> 9 #include <string.h>
10 #include <sys/epoll.h> 10 #include <sys/epoll.h>
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 initialized_ = false; 228 initialized_ = false;
229 } 229 }
230 230
231 void QuicClient::SendRequestsAndWaitForResponse( 231 void QuicClient::SendRequestsAndWaitForResponse(
232 const base::CommandLine::StringVector& args) { 232 const base::CommandLine::StringVector& args) {
233 for (size_t i = 0; i < args.size(); ++i) { 233 for (size_t i = 0; i < args.size(); ++i) {
234 BalsaHeaders headers; 234 BalsaHeaders headers;
235 headers.SetRequestFirstlineFromStringPieces("GET", args[i], "HTTP/1.1"); 235 headers.SetRequestFirstlineFromStringPieces("GET", args[i], "HTTP/1.1");
236 QuicSpdyClientStream* stream = CreateReliableClientStream(); 236 QuicSpdyClientStream* stream = CreateReliableClientStream();
237 DCHECK(stream != nullptr); 237 DCHECK(stream != nullptr);
238 if (stream == nullptr) {
239 LOG(ERROR) << "stream creation failed!";
240 break;
241 }
238 stream->SendRequest(headers, "", true); 242 stream->SendRequest(headers, "", true);
239 stream->set_visitor(this); 243 stream->set_visitor(this);
240 } 244 }
241 245
242 while (WaitForEvents()) {} 246 while (WaitForEvents()) {}
243 } 247 }
244 248
245 QuicSpdyClientStream* QuicClient::CreateReliableClientStream() { 249 QuicSpdyClientStream* QuicClient::CreateReliableClientStream() {
246 if (!connected()) { 250 if (!connected()) {
247 return nullptr; 251 return nullptr;
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
310 i->second.as_string().c_str()); 314 i->second.as_string().c_str());
311 } 315 }
312 printf("%s\n", client_stream->data().c_str()); 316 printf("%s\n", client_stream->data().c_str());
313 } 317 }
314 318
315 bool QuicClient::connected() const { 319 bool QuicClient::connected() const {
316 return session_.get() && session_->connection() && 320 return session_.get() && session_->connection() &&
317 session_->connection()->connected(); 321 session_->connection()->connected();
318 } 322 }
319 323
324 bool QuicClient::goaway_received() const {
325 return session_ != nullptr && session_->goaway_received();
326 }
327
320 QuicConnectionId QuicClient::GenerateConnectionId() { 328 QuicConnectionId QuicClient::GenerateConnectionId() {
321 return QuicRandom::GetInstance()->RandUint64(); 329 return QuicRandom::GetInstance()->RandUint64();
322 } 330 }
323 331
324 QuicEpollConnectionHelper* QuicClient::CreateQuicConnectionHelper() { 332 QuicEpollConnectionHelper* QuicClient::CreateQuicConnectionHelper() {
325 return new QuicEpollConnectionHelper(epoll_server_); 333 return new QuicEpollConnectionHelper(epoll_server_);
326 } 334 }
327 335
328 QuicPacketWriter* QuicClient::CreateQuicPacketWriter() { 336 QuicPacketWriter* QuicClient::CreateQuicPacketWriter() {
329 return new QuicDefaultPacketWriter(fd_); 337 return new QuicDefaultPacketWriter(fd_);
(...skipping 26 matching lines...) Expand all
356 QuicEncryptedPacket packet(buf, bytes_read, false); 364 QuicEncryptedPacket packet(buf, bytes_read, false);
357 365
358 IPEndPoint client_address(client_ip, client_address_.port()); 366 IPEndPoint client_address(client_ip, client_address_.port());
359 session_->connection()->ProcessUdpPacket( 367 session_->connection()->ProcessUdpPacket(
360 client_address, server_address, packet); 368 client_address, server_address, packet);
361 return true; 369 return true;
362 } 370 }
363 371
364 } // namespace tools 372 } // namespace tools
365 } // namespace net 373 } // namespace net
OLDNEW
« no previous file with comments | « net/tools/quic/quic_client.h ('k') | net/tools/quic/quic_dispatcher_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698