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 // A toy client, which connects to a specified port and sends QUIC | 5 // A toy client, which connects to a specified port and sends QUIC |
6 // request to that endpoint. | 6 // request to that endpoint. |
7 | 7 |
8 #ifndef NET_TOOLS_QUIC_QUIC_CLIENT_H_ | 8 #ifndef NET_TOOLS_QUIC_QUIC_CLIENT_H_ |
9 #define NET_TOOLS_QUIC_QUIC_CLIENT_H_ | 9 #define NET_TOOLS_QUIC_QUIC_CLIENT_H_ |
10 | 10 |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 QuicPacketWriter* Create(QuicConnection* connection) const override; | 197 QuicPacketWriter* Create(QuicConnection* connection) const override; |
198 | 198 |
199 private: | 199 private: |
200 QuicPacketWriter* writer_; | 200 QuicPacketWriter* writer_; |
201 }; | 201 }; |
202 | 202 |
203 // Used during initialization: creates the UDP socket FD, sets socket options, | 203 // Used during initialization: creates the UDP socket FD, sets socket options, |
204 // and binds the socket to our address. | 204 // and binds the socket to our address. |
205 bool CreateUDPSocket(); | 205 bool CreateUDPSocket(); |
206 | 206 |
| 207 // If the socket has been created, then unregister and close() the FD. |
| 208 void CleanUpUDPSocket(); |
| 209 |
207 // Read a UDP packet and hand it to the framer. | 210 // Read a UDP packet and hand it to the framer. |
208 bool ReadAndProcessPacket(); | 211 bool ReadAndProcessPacket(); |
209 | 212 |
210 // Address of the server. | 213 // Address of the server. |
211 const IPEndPoint server_address_; | 214 const IPEndPoint server_address_; |
212 | 215 |
213 // |server_id_| is a tuple (hostname, port, is_https) of the server. | 216 // |server_id_| is a tuple (hostname, port, is_https) of the server. |
214 QuicServerId server_id_; | 217 QuicServerId server_id_; |
215 | 218 |
216 // config_ and crypto_config_ contain configuration and cached state about | 219 // config_ and crypto_config_ contain configuration and cached state about |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 // when the stream is closed (in OnClose). | 268 // when the stream is closed (in OnClose). |
266 bool print_response_; | 269 bool print_response_; |
267 | 270 |
268 DISALLOW_COPY_AND_ASSIGN(QuicClient); | 271 DISALLOW_COPY_AND_ASSIGN(QuicClient); |
269 }; | 272 }; |
270 | 273 |
271 } // namespace tools | 274 } // namespace tools |
272 } // namespace net | 275 } // namespace net |
273 | 276 |
274 #endif // NET_TOOLS_QUIC_QUIC_CLIENT_H_ | 277 #endif // NET_TOOLS_QUIC_QUIC_CLIENT_H_ |
OLD | NEW |