Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Side by Side Diff: net/tools/quic/quic_client.h

Issue 139103002: Break out of the loop in QuicSession::OnCanWrite if the QuicConnection (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « net/quic/quic_session_test.cc ('k') | net/tools/quic/quic_client.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 19 matching lines...) Expand all
30 30
31 class QuicEpollConnectionHelper; 31 class QuicEpollConnectionHelper;
32 32
33 namespace test { 33 namespace test {
34 class QuicClientPeer; 34 class QuicClientPeer;
35 } // namespace test 35 } // namespace test
36 36
37 class QuicClient : public EpollCallbackInterface, 37 class QuicClient : public EpollCallbackInterface,
38 public QuicDataStream::Visitor { 38 public QuicDataStream::Visitor {
39 public: 39 public:
40 class ResponseListener {
41 public:
42 ResponseListener() {}
43 virtual ~ResponseListener() {}
44 virtual void OnCompleteResponse(QuicStreamId id,
45 const BalsaHeaders& response_headers,
46 const string& response_body) = 0;
47 };
48
40 QuicClient(IPEndPoint server_address, 49 QuicClient(IPEndPoint server_address,
41 const string& server_hostname, 50 const string& server_hostname,
42 const QuicVersionVector& supported_versions, 51 const QuicVersionVector& supported_versions,
43 bool print_response); 52 bool print_response);
44 QuicClient(IPEndPoint server_address, 53 QuicClient(IPEndPoint server_address,
45 const std::string& server_hostname, 54 const std::string& server_hostname,
46 const QuicConfig& config, 55 const QuicConfig& config,
47 const QuicVersionVector& supported_versions); 56 const QuicVersionVector& supported_versions);
48 57
49 virtual ~QuicClient(); 58 virtual ~QuicClient();
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 // given ChannelID. This object takes ownership of |signer|. 155 // given ChannelID. This object takes ownership of |signer|.
147 void SetChannelIDSigner(ChannelIDSigner* signer) { 156 void SetChannelIDSigner(ChannelIDSigner* signer) {
148 crypto_config_.SetChannelIDSigner(signer); 157 crypto_config_.SetChannelIDSigner(signer);
149 } 158 }
150 159
151 void SetSupportedVersions(const QuicVersionVector& versions) { 160 void SetSupportedVersions(const QuicVersionVector& versions) {
152 DCHECK(!session_.get()); 161 DCHECK(!session_.get());
153 supported_versions_ = versions; 162 supported_versions_ = versions;
154 } 163 }
155 164
165 // Takes ownership of the listener.
166 void set_response_listener(ResponseListener* listener) {
167 response_listener_.reset(listener);
168 }
169
156 protected: 170 protected:
157 virtual QuicGuid GenerateGuid(); 171 virtual QuicGuid GenerateGuid();
158 virtual QuicEpollConnectionHelper* CreateQuicConnectionHelper(); 172 virtual QuicEpollConnectionHelper* CreateQuicConnectionHelper();
159 virtual QuicPacketWriter* CreateQuicPacketWriter(); 173 virtual QuicPacketWriter* CreateQuicPacketWriter();
160 174
161 private: 175 private:
162 friend class net::tools::test::QuicClientPeer; 176 friend class net::tools::test::QuicClientPeer;
163 177
164 // Read a UDP packet and hand it to the framer. 178 // Read a UDP packet and hand it to the framer.
165 bool ReadAndProcessPacket(); 179 bool ReadAndProcessPacket();
(...skipping 20 matching lines...) Expand all
186 // Session which manages streams. 200 // Session which manages streams.
187 scoped_ptr<QuicClientSession> session_; 201 scoped_ptr<QuicClientSession> session_;
188 // Listens for events on the client socket. 202 // Listens for events on the client socket.
189 EpollServer epoll_server_; 203 EpollServer epoll_server_;
190 // UDP socket. 204 // UDP socket.
191 int fd_; 205 int fd_;
192 206
193 // Helper to be used by created connections. 207 // Helper to be used by created connections.
194 scoped_ptr<QuicEpollConnectionHelper> helper_; 208 scoped_ptr<QuicEpollConnectionHelper> helper_;
195 209
210 // Listens for full responses.
211 scoped_ptr<ResponseListener> response_listener_;
212
196 // Writer used to actually send packets to the wire. 213 // Writer used to actually send packets to the wire.
197 scoped_ptr<QuicPacketWriter> writer_; 214 scoped_ptr<QuicPacketWriter> writer_;
198 215
199 // Tracks if the client is initialized to connect. 216 // Tracks if the client is initialized to connect.
200 bool initialized_; 217 bool initialized_;
201 218
202 // If overflow_supported_ is true, this will be the number of packets dropped 219 // If overflow_supported_ is true, this will be the number of packets dropped
203 // during the lifetime of the server. This may overflow if enough packets 220 // during the lifetime of the server. This may overflow if enough packets
204 // are dropped. 221 // are dropped.
205 int packets_dropped_; 222 int packets_dropped_;
(...skipping 13 matching lines...) Expand all
219 // when the stream is closed (in OnClose). 236 // when the stream is closed (in OnClose).
220 bool print_response_; 237 bool print_response_;
221 238
222 DISALLOW_COPY_AND_ASSIGN(QuicClient); 239 DISALLOW_COPY_AND_ASSIGN(QuicClient);
223 }; 240 };
224 241
225 } // namespace tools 242 } // namespace tools
226 } // namespace net 243 } // namespace net
227 244
228 #endif // NET_TOOLS_QUIC_QUIC_CLIENT_H_ 245 #endif // NET_TOOLS_QUIC_QUIC_CLIENT_H_
OLDNEW
« no previous file with comments | « net/quic/quic_session_test.cc ('k') | net/tools/quic/quic_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698