| 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/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 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 284 StringPiece body, | 284 StringPiece body, |
| 285 bool fin) { | 285 bool fin) { |
| 286 QuicClientPushPromiseIndex::TryHandle* handle; | 286 QuicClientPushPromiseIndex::TryHandle* handle; |
| 287 QuicAsyncStatus rv = push_promise_index()->Try( | 287 QuicAsyncStatus rv = push_promise_index()->Try( |
| 288 SpdyBalsaUtils::RequestHeadersToSpdyHeaders(headers), this, &handle); | 288 SpdyBalsaUtils::RequestHeadersToSpdyHeaders(headers), this, &handle); |
| 289 if (rv == QUIC_SUCCESS) | 289 if (rv == QUIC_SUCCESS) |
| 290 return; | 290 return; |
| 291 | 291 |
| 292 if (rv == QUIC_PENDING) { | 292 if (rv == QUIC_PENDING) { |
| 293 // May need to retry request if asynchronous rendezvous fails. | 293 // May need to retry request if asynchronous rendezvous fails. |
| 294 auto new_headers = new BalsaHeaders; | 294 auto* new_headers = new BalsaHeaders; |
| 295 new_headers->CopyFrom(headers); | 295 new_headers->CopyFrom(headers); |
| 296 push_promise_data_to_resend_.reset( | 296 push_promise_data_to_resend_.reset( |
| 297 new ClientQuicDataToResend(new_headers, body, fin, this)); | 297 new ClientQuicDataToResend(new_headers, body, fin, this)); |
| 298 return; | 298 return; |
| 299 } | 299 } |
| 300 | 300 |
| 301 QuicSpdyClientStream* stream = CreateReliableClientStream(); | 301 QuicSpdyClientStream* stream = CreateReliableClientStream(); |
| 302 if (stream == nullptr) { | 302 if (stream == nullptr) { |
| 303 QUIC_BUG << "stream creation failed!"; | 303 QUIC_BUG << "stream creation failed!"; |
| 304 return; | 304 return; |
| 305 } | 305 } |
| 306 stream->SendRequest(SpdyBalsaUtils::RequestHeadersToSpdyHeaders(headers), | 306 stream->SendRequest(SpdyBalsaUtils::RequestHeadersToSpdyHeaders(headers), |
| 307 body, fin); | 307 body, fin); |
| 308 if (FLAGS_enable_quic_stateless_reject_support) { | 308 if (FLAGS_enable_quic_stateless_reject_support) { |
| 309 // Record this in case we need to resend. | 309 // Record this in case we need to resend. |
| 310 auto new_headers = new BalsaHeaders; | 310 auto* new_headers = new BalsaHeaders; |
| 311 new_headers->CopyFrom(headers); | 311 new_headers->CopyFrom(headers); |
| 312 auto data_to_resend = | 312 auto* data_to_resend = |
| 313 new ClientQuicDataToResend(new_headers, body, fin, this); | 313 new ClientQuicDataToResend(new_headers, body, fin, this); |
| 314 MaybeAddQuicDataToResend(data_to_resend); | 314 MaybeAddQuicDataToResend(data_to_resend); |
| 315 } | 315 } |
| 316 } | 316 } |
| 317 | 317 |
| 318 void QuicClient::MaybeAddQuicDataToResend(QuicDataToResend* data_to_resend) { | 318 void QuicClient::MaybeAddQuicDataToResend(QuicDataToResend* data_to_resend) { |
| 319 DCHECK(FLAGS_enable_quic_stateless_reject_support); | 319 DCHECK(FLAGS_enable_quic_stateless_reject_support); |
| 320 if (session()->IsCryptoHandshakeConfirmed()) { | 320 if (session()->IsCryptoHandshakeConfirmed()) { |
| 321 // The handshake is confirmed. No need to continue saving requests to | 321 // The handshake is confirmed. No need to continue saving requests to |
| 322 // resend. | 322 // resend. |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 498 return fd_address_map_.back().first; | 498 return fd_address_map_.back().first; |
| 499 } | 499 } |
| 500 | 500 |
| 501 void QuicClient::ProcessPacket(const IPEndPoint& self_address, | 501 void QuicClient::ProcessPacket(const IPEndPoint& self_address, |
| 502 const IPEndPoint& peer_address, | 502 const IPEndPoint& peer_address, |
| 503 const QuicReceivedPacket& packet) { | 503 const QuicReceivedPacket& packet) { |
| 504 session()->connection()->ProcessUdpPacket(self_address, peer_address, packet); | 504 session()->connection()->ProcessUdpPacket(self_address, peer_address, packet); |
| 505 } | 505 } |
| 506 | 506 |
| 507 } // namespace net | 507 } // namespace net |
| OLD | NEW |