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 13 matching lines...) Expand all Loading... |
24 #include "net/tools/quic/spdy_balsa_utils.h" | 24 #include "net/tools/quic/spdy_balsa_utils.h" |
25 | 25 |
26 #ifndef SO_RXQ_OVFL | 26 #ifndef SO_RXQ_OVFL |
27 #define SO_RXQ_OVFL 40 | 27 #define SO_RXQ_OVFL 40 |
28 #endif | 28 #endif |
29 | 29 |
30 using std::string; | 30 using std::string; |
31 using std::vector; | 31 using std::vector; |
32 | 32 |
33 namespace net { | 33 namespace net { |
| 34 |
| 35 class SocketPerformanceWatcher; |
| 36 |
34 namespace tools { | 37 namespace tools { |
35 | 38 |
36 const int kEpollFlags = EPOLLIN | EPOLLOUT | EPOLLET; | 39 const int kEpollFlags = EPOLLIN | EPOLLOUT | EPOLLET; |
37 | 40 |
38 void QuicClient::ClientQuicDataToResend::Resend() { | 41 void QuicClient::ClientQuicDataToResend::Resend() { |
39 client_->SendRequest(*headers_, body_, fin_); | 42 client_->SendRequest(*headers_, body_, fin_); |
40 delete headers_; | 43 delete headers_; |
41 headers_ = nullptr; | 44 headers_ = nullptr; |
42 } | 45 } |
43 | 46 |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 // TODO(jokulik): I'm a little bit concerned about ordering here. Maybe | 239 // TODO(jokulik): I'm a little bit concerned about ordering here. Maybe |
237 // we should just maintain one queue? | 240 // we should just maintain one queue? |
238 DCHECK(data_to_resend_on_connect_.empty()); | 241 DCHECK(data_to_resend_on_connect_.empty()); |
239 data_to_resend_on_connect_.swap(data_sent_before_handshake_); | 242 data_to_resend_on_connect_.swap(data_sent_before_handshake_); |
240 } | 243 } |
241 } | 244 } |
242 | 245 |
243 CreateQuicClientSession(new QuicConnection( | 246 CreateQuicClientSession(new QuicConnection( |
244 GetNextConnectionId(), server_address_, helper_.get(), factory, | 247 GetNextConnectionId(), server_address_, helper_.get(), factory, |
245 /* owns_writer= */ false, Perspective::IS_CLIENT, server_id().is_https(), | 248 /* owns_writer= */ false, Perspective::IS_CLIENT, server_id().is_https(), |
246 supported_versions())); | 249 supported_versions(), scoped_ptr<SocketPerformanceWatcher>())); |
247 | 250 |
248 // 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 |
249 // session. | 252 // session. |
250 set_writer(writer); | 253 set_writer(writer); |
251 session()->Initialize(); | 254 session()->Initialize(); |
252 session()->CryptoConnect(); | 255 session()->CryptoConnect(); |
253 set_connected_or_attempting_connect(true); | 256 set_connected_or_attempting_connect(true); |
254 } | 257 } |
255 | 258 |
256 void QuicClient::Disconnect() { | 259 void QuicClient::Disconnect() { |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
462 QuicEncryptedPacket packet(buf, bytes_read, false); | 465 QuicEncryptedPacket packet(buf, bytes_read, false); |
463 | 466 |
464 IPEndPoint client_address(client_ip, client_address_.port()); | 467 IPEndPoint client_address(client_ip, client_address_.port()); |
465 session()->connection()->ProcessUdpPacket(client_address, server_address, | 468 session()->connection()->ProcessUdpPacket(client_address, server_address, |
466 packet); | 469 packet); |
467 return true; | 470 return true; |
468 } | 471 } |
469 | 472 |
470 } // namespace tools | 473 } // namespace tools |
471 } // namespace net | 474 } // namespace net |
OLD | NEW |