| 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 27 matching lines...) Expand all Loading... |
| 38 | 38 |
| 39 void QuicClient::ClientQuicDataToResend::Resend() { | 39 void QuicClient::ClientQuicDataToResend::Resend() { |
| 40 client_->SendRequest(*headers_, body_, fin_); | 40 client_->SendRequest(*headers_, body_, fin_); |
| 41 delete headers_; | 41 delete headers_; |
| 42 headers_ = nullptr; | 42 headers_ = nullptr; |
| 43 } | 43 } |
| 44 | 44 |
| 45 QuicClient::QuicClient(IPEndPoint server_address, | 45 QuicClient::QuicClient(IPEndPoint server_address, |
| 46 const QuicServerId& server_id, | 46 const QuicServerId& server_id, |
| 47 const QuicVersionVector& supported_versions, | 47 const QuicVersionVector& supported_versions, |
| 48 EpollServer* epoll_server) | 48 EpollServer* epoll_server, |
| 49 ProofVerifier* proof_verifier) |
| 49 : QuicClient(server_address, | 50 : QuicClient(server_address, |
| 50 server_id, | 51 server_id, |
| 51 supported_versions, | 52 supported_versions, |
| 52 QuicConfig(), | 53 QuicConfig(), |
| 53 epoll_server) {} | 54 epoll_server, |
| 55 proof_verifier) {} |
| 54 | 56 |
| 55 QuicClient::QuicClient(IPEndPoint server_address, | 57 QuicClient::QuicClient(IPEndPoint server_address, |
| 56 const QuicServerId& server_id, | 58 const QuicServerId& server_id, |
| 57 const QuicVersionVector& supported_versions, | 59 const QuicVersionVector& supported_versions, |
| 58 const QuicConfig& config, | 60 const QuicConfig& config, |
| 59 EpollServer* epoll_server) | 61 EpollServer* epoll_server, |
| 60 : QuicClientBase(server_id, supported_versions, config), | 62 ProofVerifier* proof_verifier) |
| 63 : QuicClientBase(server_id, supported_versions, config, proof_verifier), |
| 61 server_address_(server_address), | 64 server_address_(server_address), |
| 62 local_port_(0), | 65 local_port_(0), |
| 63 epoll_server_(epoll_server), | 66 epoll_server_(epoll_server), |
| 64 fd_(-1), | 67 fd_(-1), |
| 65 helper_(CreateQuicConnectionHelper()), | 68 helper_(CreateQuicConnectionHelper()), |
| 66 initialized_(false), | 69 initialized_(false), |
| 67 packets_dropped_(0), | 70 packets_dropped_(0), |
| 68 overflow_supported_(false), | 71 overflow_supported_(false), |
| 69 store_response_(false), | 72 store_response_(false), |
| 70 latest_response_code_(-1) {} | 73 latest_response_code_(-1) {} |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 // be resent on the next successful connection. | 239 // be resent on the next successful connection. |
| 237 // TODO(jokulik): I'm a little bit concerned about ordering here. Maybe | 240 // TODO(jokulik): I'm a little bit concerned about ordering here. Maybe |
| 238 // we should just maintain one queue? | 241 // we should just maintain one queue? |
| 239 DCHECK(data_to_resend_on_connect_.empty()); | 242 DCHECK(data_to_resend_on_connect_.empty()); |
| 240 data_to_resend_on_connect_.swap(data_sent_before_handshake_); | 243 data_to_resend_on_connect_.swap(data_sent_before_handshake_); |
| 241 } | 244 } |
| 242 } | 245 } |
| 243 | 246 |
| 244 CreateQuicClientSession(new QuicConnection( | 247 CreateQuicClientSession(new QuicConnection( |
| 245 GetNextConnectionId(), server_address_, helper_.get(), factory, | 248 GetNextConnectionId(), server_address_, helper_.get(), factory, |
| 246 /* owns_writer= */ false, Perspective::IS_CLIENT, server_id().is_https(), | 249 /* owns_writer= */ false, Perspective::IS_CLIENT, supported_versions())); |
| 247 supported_versions())); | |
| 248 | 250 |
| 249 // Reset |writer_| after |session()| so that the old writer outlives the old | 251 // Reset |writer_| after |session()| so that the old writer outlives the old |
| 250 // session. | 252 // session. |
| 251 set_writer(writer); | 253 set_writer(writer); |
| 252 session()->Initialize(); | 254 session()->Initialize(); |
| 253 session()->CryptoConnect(); | 255 session()->CryptoConnect(); |
| 254 set_connected_or_attempting_connect(true); | 256 set_connected_or_attempting_connect(true); |
| 255 } | 257 } |
| 256 | 258 |
| 257 void QuicClient::Disconnect() { | 259 void QuicClient::Disconnect() { |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 463 QuicEncryptedPacket packet(buf, bytes_read, false); | 465 QuicEncryptedPacket packet(buf, bytes_read, false); |
| 464 | 466 |
| 465 IPEndPoint client_address(client_ip, client_address_.port()); | 467 IPEndPoint client_address(client_ip, client_address_.port()); |
| 466 session()->connection()->ProcessUdpPacket(client_address, server_address, | 468 session()->connection()->ProcessUdpPacket(client_address, server_address, |
| 467 packet); | 469 packet); |
| 468 return true; | 470 return true; |
| 469 } | 471 } |
| 470 | 472 |
| 471 } // namespace tools | 473 } // namespace tools |
| 472 } // namespace net | 474 } // namespace net |
| OLD | NEW |