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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 const QuicServerId& server_id, | 61 const QuicServerId& server_id, |
62 const QuicVersionVector& supported_versions, | 62 const QuicVersionVector& supported_versions, |
63 const QuicConfig& config, | 63 const QuicConfig& config, |
64 EpollServer* epoll_server, | 64 EpollServer* epoll_server, |
65 ProofVerifier* proof_verifier) | 65 ProofVerifier* proof_verifier) |
66 : QuicClientBase( | 66 : QuicClientBase( |
67 server_id, | 67 server_id, |
68 supported_versions, | 68 supported_versions, |
69 config, | 69 config, |
70 new QuicEpollConnectionHelper(epoll_server, QuicAllocator::SIMPLE), | 70 new QuicEpollConnectionHelper(epoll_server, QuicAllocator::SIMPLE), |
| 71 new QuicEpollAlarmFactory(epoll_server), |
71 proof_verifier), | 72 proof_verifier), |
72 server_address_(server_address), | 73 server_address_(server_address), |
73 local_port_(0), | 74 local_port_(0), |
74 epoll_server_(epoll_server), | 75 epoll_server_(epoll_server), |
75 initialized_(false), | 76 initialized_(false), |
76 packets_dropped_(0), | 77 packets_dropped_(0), |
77 overflow_supported_(false), | 78 overflow_supported_(false), |
78 store_response_(false), | 79 store_response_(false), |
79 latest_response_code_(-1), | 80 latest_response_code_(-1), |
80 packet_reader_(new QuicPacketReader()) {} | 81 packet_reader_(new QuicPacketReader()) {} |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 // If the last error was due to a stateless reject, queue up the data to | 224 // If the last error was due to a stateless reject, queue up the data to |
224 // be resent on the next successful connection. | 225 // be resent on the next successful connection. |
225 // TODO(jokulik): I'm a little bit concerned about ordering here. Maybe | 226 // TODO(jokulik): I'm a little bit concerned about ordering here. Maybe |
226 // we should just maintain one queue? | 227 // we should just maintain one queue? |
227 DCHECK(data_to_resend_on_connect_.empty()); | 228 DCHECK(data_to_resend_on_connect_.empty()); |
228 data_to_resend_on_connect_.swap(data_sent_before_handshake_); | 229 data_to_resend_on_connect_.swap(data_sent_before_handshake_); |
229 } | 230 } |
230 } | 231 } |
231 | 232 |
232 CreateQuicClientSession(new QuicConnection( | 233 CreateQuicClientSession(new QuicConnection( |
233 GetNextConnectionId(), server_address_, helper(), writer, | 234 GetNextConnectionId(), server_address_, helper(), alarm_factory(), writer, |
234 /* owns_writer= */ false, Perspective::IS_CLIENT, supported_versions())); | 235 /* owns_writer= */ false, Perspective::IS_CLIENT, supported_versions())); |
235 | 236 |
236 // Reset |writer_| after |session()| so that the old writer outlives the old | 237 // Reset |writer_| after |session()| so that the old writer outlives the old |
237 // session. | 238 // session. |
238 set_writer(writer); | 239 set_writer(writer); |
239 session()->Initialize(); | 240 session()->Initialize(); |
240 session()->CryptoConnect(); | 241 session()->CryptoConnect(); |
241 set_connected_or_attempting_connect(true); | 242 set_connected_or_attempting_connect(true); |
242 } | 243 } |
243 | 244 |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
488 return fd_address_map_.back().first; | 489 return fd_address_map_.back().first; |
489 } | 490 } |
490 | 491 |
491 void QuicClient::ProcessPacket(const IPEndPoint& self_address, | 492 void QuicClient::ProcessPacket(const IPEndPoint& self_address, |
492 const IPEndPoint& peer_address, | 493 const IPEndPoint& peer_address, |
493 const QuicReceivedPacket& packet) { | 494 const QuicReceivedPacket& packet) { |
494 session()->connection()->ProcessUdpPacket(self_address, peer_address, packet); | 495 session()->connection()->ProcessUdpPacket(self_address, peer_address, packet); |
495 } | 496 } |
496 | 497 |
497 } // namespace net | 498 } // namespace net |
OLD | NEW |