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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 fd_(-1), | 67 fd_(-1), |
68 helper_(CreateQuicConnectionHelper()), | 68 helper_(CreateQuicConnectionHelper()), |
69 initialized_(false), | 69 initialized_(false), |
70 packets_dropped_(0), | 70 packets_dropped_(0), |
71 overflow_supported_(false), | 71 overflow_supported_(false), |
72 store_response_(false), | 72 store_response_(false), |
73 latest_response_code_(-1) {} | 73 latest_response_code_(-1) {} |
74 | 74 |
75 QuicClient::~QuicClient() { | 75 QuicClient::~QuicClient() { |
76 if (connected()) { | 76 if (connected()) { |
77 session()->connection()->SendConnectionClose(QUIC_PEER_GOING_AWAY); | 77 session()->connection()->SendConnectionCloseWithDetails( |
| 78 QUIC_PEER_GOING_AWAY, "Client being torn down"); |
78 } | 79 } |
79 | 80 |
80 STLDeleteElements(&data_to_resend_on_connect_); | 81 STLDeleteElements(&data_to_resend_on_connect_); |
81 STLDeleteElements(&data_sent_before_handshake_); | 82 STLDeleteElements(&data_sent_before_handshake_); |
82 | 83 |
83 CleanUpUDPSocketImpl(); | 84 CleanUpUDPSocketImpl(); |
84 } | 85 } |
85 | 86 |
86 bool QuicClient::Initialize() { | 87 bool QuicClient::Initialize() { |
87 QuicClientBase::Initialize(); | 88 QuicClientBase::Initialize(); |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 set_writer(writer); | 253 set_writer(writer); |
253 session()->Initialize(); | 254 session()->Initialize(); |
254 session()->CryptoConnect(); | 255 session()->CryptoConnect(); |
255 set_connected_or_attempting_connect(true); | 256 set_connected_or_attempting_connect(true); |
256 } | 257 } |
257 | 258 |
258 void QuicClient::Disconnect() { | 259 void QuicClient::Disconnect() { |
259 DCHECK(initialized_); | 260 DCHECK(initialized_); |
260 | 261 |
261 if (connected()) { | 262 if (connected()) { |
262 session()->connection()->SendConnectionClose(QUIC_PEER_GOING_AWAY); | 263 session()->connection()->SendConnectionCloseWithDetails( |
| 264 QUIC_PEER_GOING_AWAY, "Client disconnecting"); |
263 } | 265 } |
264 STLDeleteElements(&data_to_resend_on_connect_); | 266 STLDeleteElements(&data_to_resend_on_connect_); |
265 STLDeleteElements(&data_sent_before_handshake_); | 267 STLDeleteElements(&data_sent_before_handshake_); |
266 | 268 |
267 CleanUpUDPSocket(); | 269 CleanUpUDPSocket(); |
268 | 270 |
269 initialized_ = false; | 271 initialized_ = false; |
270 } | 272 } |
271 | 273 |
272 void QuicClient::CleanUpUDPSocket() { | 274 void QuicClient::CleanUpUDPSocket() { |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
471 QuicEncryptedPacket packet(buf, bytes_read, false); | 473 QuicEncryptedPacket packet(buf, bytes_read, false); |
472 | 474 |
473 IPEndPoint client_address(client_ip, client_address_.port()); | 475 IPEndPoint client_address(client_ip, client_address_.port()); |
474 session()->connection()->ProcessUdpPacket(client_address, server_address, | 476 session()->connection()->ProcessUdpPacket(client_address, server_address, |
475 packet); | 477 packet); |
476 return true; | 478 return true; |
477 } | 479 } |
478 | 480 |
479 } // namespace tools | 481 } // namespace tools |
480 } // namespace net | 482 } // namespace net |
OLD | NEW |