OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 server, which listens on a specified address for QUIC traffic and | 5 // A toy server, which listens on a specified address for QUIC traffic and |
6 // handles incoming responses. | 6 // handles incoming responses. |
7 | 7 |
8 #ifndef NET_QUIC_TOOLS_QUIC_SIMPLE_SERVER_H_ | 8 #ifndef NET_QUIC_TOOLS_QUIC_SIMPLE_SERVER_H_ |
9 #define NET_QUIC_TOOLS_QUIC_SIMPLE_SERVER_H_ | 9 #define NET_QUIC_TOOLS_QUIC_SIMPLE_SERVER_H_ |
10 | 10 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 virtual ~QuicSimpleServer(); | 42 virtual ~QuicSimpleServer(); |
43 | 43 |
44 // Start listening on the specified address. Returns an error code. | 44 // Start listening on the specified address. Returns an error code. |
45 int Listen(const IPEndPoint& address); | 45 int Listen(const IPEndPoint& address); |
46 | 46 |
47 // Server deletion is imminent. Start cleaning up. | 47 // Server deletion is imminent. Start cleaning up. |
48 void Shutdown(); | 48 void Shutdown(); |
49 | 49 |
50 // Start reading on the socket. On asynchronous reads, this registers | 50 // Start reading on the socket. On asynchronous reads, this registers |
51 // OnReadComplete as the callback, which will then call StartReading again. | 51 // OnReadComplete as the callback, which will then call StartReading again. |
52 void StartReading(); | 52 void StartReading(bool check_packet_buffer); |
53 | 53 |
54 // Called on reads that complete asynchronously. Dispatches the packet and | 54 // Called on reads that complete asynchronously. Dispatches the packet and |
55 // continues the read loop. | 55 // continues the read loop. |
56 void OnReadComplete(int result); | 56 void OnAsyncReadComplete(int result); |
| 57 |
| 58 void OnReadComplete(int result, bool check_packet_buffer); |
57 | 59 |
58 void SetStrikeRegisterNoStartupPeriod() { | 60 void SetStrikeRegisterNoStartupPeriod() { |
59 crypto_config_.set_strike_register_no_startup_period(); | 61 crypto_config_.set_strike_register_no_startup_period(); |
60 } | 62 } |
61 | 63 |
62 QuicDispatcher* dispatcher() { return dispatcher_.get(); } | 64 QuicDispatcher* dispatcher() { return dispatcher_.get(); } |
63 | 65 |
64 IPEndPoint server_address() const { return server_address_; } | 66 IPEndPoint server_address() const { return server_address_; } |
65 | 67 |
66 private: | 68 private: |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 NetLog net_log_; | 118 NetLog net_log_; |
117 | 119 |
118 base::WeakPtrFactory<QuicSimpleServer> weak_factory_; | 120 base::WeakPtrFactory<QuicSimpleServer> weak_factory_; |
119 | 121 |
120 DISALLOW_COPY_AND_ASSIGN(QuicSimpleServer); | 122 DISALLOW_COPY_AND_ASSIGN(QuicSimpleServer); |
121 }; | 123 }; |
122 | 124 |
123 } // namespace net | 125 } // namespace net |
124 | 126 |
125 #endif // NET_QUIC_TOOLS_QUIC_SIMPLE_SERVER_H_ | 127 #endif // NET_QUIC_TOOLS_QUIC_SIMPLE_SERVER_H_ |
OLD | NEW |