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 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 set_writer(writer); | 254 set_writer(writer); |
254 session()->Initialize(); | 255 session()->Initialize(); |
255 session()->CryptoConnect(); | 256 session()->CryptoConnect(); |
256 set_connected_or_attempting_connect(true); | 257 set_connected_or_attempting_connect(true); |
257 } | 258 } |
258 | 259 |
259 void QuicClient::Disconnect() { | 260 void QuicClient::Disconnect() { |
260 DCHECK(initialized_); | 261 DCHECK(initialized_); |
261 | 262 |
262 if (connected()) { | 263 if (connected()) { |
263 session()->connection()->SendConnectionClose(QUIC_PEER_GOING_AWAY); | 264 session()->connection()->SendConnectionCloseWithDetails( |
| 265 QUIC_PEER_GOING_AWAY, "Client disconnecting"); |
264 } | 266 } |
265 STLDeleteElements(&data_to_resend_on_connect_); | 267 STLDeleteElements(&data_to_resend_on_connect_); |
266 STLDeleteElements(&data_sent_before_handshake_); | 268 STLDeleteElements(&data_sent_before_handshake_); |
267 | 269 |
268 CleanUpUDPSocket(); | 270 CleanUpUDPSocket(); |
269 | 271 |
270 initialized_ = false; | 272 initialized_ = false; |
271 } | 273 } |
272 | 274 |
273 void QuicClient::CleanUpUDPSocket() { | 275 void QuicClient::CleanUpUDPSocket() { |
(...skipping 197 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 |