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 client specific QuicSession subclass. This class owns the underlying | 5 // A client specific QuicSession subclass. This class owns the underlying |
6 // QuicConnection and QuicConnectionHelper objects. The connection stores | 6 // QuicConnection and QuicConnectionHelper objects. The connection stores |
7 // a non-owning pointer to the helper so this session needs to ensure that | 7 // a non-owning pointer to the helper so this session needs to ensure that |
8 // the helper outlives the connection. | 8 // the helper outlives the connection. |
9 | 9 |
10 #ifndef NET_QUIC_QUIC_CLIENT_SESSION_H_ | 10 #ifndef NET_QUIC_QUIC_CLIENT_SESSION_H_ |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 int ResumeCryptoConnect(const CompletionCallback& callback); | 166 int ResumeCryptoConnect(const CompletionCallback& callback); |
167 | 167 |
168 // Causes the QuicConnectionHelper to start reading from the socket | 168 // Causes the QuicConnectionHelper to start reading from the socket |
169 // and passing the data along to the QuicConnection. | 169 // and passing the data along to the QuicConnection. |
170 void StartReading(); | 170 void StartReading(); |
171 | 171 |
172 // Close the session because of |error| and notifies the factory | 172 // Close the session because of |error| and notifies the factory |
173 // that this session has been closed, which will delete the session. | 173 // that this session has been closed, which will delete the session. |
174 void CloseSessionOnError(int error, QuicErrorCode quic_error); | 174 void CloseSessionOnError(int error, QuicErrorCode quic_error); |
175 | 175 |
| 176 // Close the session because of |error| and notifies the factory later that |
| 177 // this session has been closed, which will delete the session. |
| 178 void CloseSessionOnErrorAndNotifyFactoryLater(int error, |
| 179 QuicErrorCode quic_error); |
| 180 |
176 base::Value* GetInfoAsValue(const std::set<HostPortPair>& aliases); | 181 base::Value* GetInfoAsValue(const std::set<HostPortPair>& aliases); |
177 | 182 |
178 const BoundNetLog& net_log() const { return net_log_; } | 183 const BoundNetLog& net_log() const { return net_log_; } |
179 | 184 |
180 base::WeakPtr<QuicClientSession> GetWeakPtr(); | 185 base::WeakPtr<QuicClientSession> GetWeakPtr(); |
181 | 186 |
182 // Returns the number of client hello messages that have been sent on the | 187 // Returns the number of client hello messages that have been sent on the |
183 // crypto stream. If the handshake has completed then this is one greater | 188 // crypto stream. If the handshake has completed then this is one greater |
184 // than the number of round-trips needed for the handshake. | 189 // than the number of round-trips needed for the handshake. |
185 int GetNumSentClientHellos() const; | 190 int GetNumSentClientHellos() const; |
(...skipping 14 matching lines...) Expand all Loading... |
200 | 205 |
201 typedef std::set<Observer*> ObserverSet; | 206 typedef std::set<Observer*> ObserverSet; |
202 typedef std::list<StreamRequest*> StreamRequestQueue; | 207 typedef std::list<StreamRequest*> StreamRequestQueue; |
203 | 208 |
204 QuicReliableClientStream* CreateOutgoingReliableStreamImpl(); | 209 QuicReliableClientStream* CreateOutgoingReliableStreamImpl(); |
205 // A completion callback invoked when a read completes. | 210 // A completion callback invoked when a read completes. |
206 void OnReadComplete(int result); | 211 void OnReadComplete(int result); |
207 | 212 |
208 void OnClosedStream(); | 213 void OnClosedStream(); |
209 | 214 |
| 215 // Close the session because of |error| and records it in UMA histogram. |
| 216 void RecordAndCloseSessionOnError(int error, QuicErrorCode quic_error); |
| 217 |
210 // A Session may be closed via any of three methods: | 218 // A Session may be closed via any of three methods: |
211 // OnConnectionClosed - called by the connection when the connection has been | 219 // OnConnectionClosed - called by the connection when the connection has been |
212 // closed, perhaps due to a timeout or a protocol error. | 220 // closed, perhaps due to a timeout or a protocol error. |
213 // CloseSessionOnError - called from the owner of the session, | 221 // CloseSessionOnError - called from the owner of the session, |
214 // the QuicStreamFactory, when there is an error. | 222 // the QuicStreamFactory, when there is an error. |
215 // OnReadComplete - when there is a read error. | 223 // OnReadComplete - when there is a read error. |
216 // This method closes all stream and performs any necessary cleanup. | 224 // This method closes all stream and performs any necessary cleanup. |
217 void CloseSessionOnErrorInner(int net_error, QuicErrorCode quic_error); | 225 void CloseSessionOnErrorInner(int net_error, QuicErrorCode quic_error); |
218 | 226 |
219 void CloseAllStreams(int net_error); | 227 void CloseAllStreams(int net_error); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 // on this session. Existing stream will continue to be processed. | 264 // on this session. Existing stream will continue to be processed. |
257 bool going_away_; | 265 bool going_away_; |
258 base::WeakPtrFactory<QuicClientSession> weak_factory_; | 266 base::WeakPtrFactory<QuicClientSession> weak_factory_; |
259 | 267 |
260 DISALLOW_COPY_AND_ASSIGN(QuicClientSession); | 268 DISALLOW_COPY_AND_ASSIGN(QuicClientSession); |
261 }; | 269 }; |
262 | 270 |
263 } // namespace net | 271 } // namespace net |
264 | 272 |
265 #endif // NET_QUIC_QUIC_CLIENT_SESSION_H_ | 273 #endif // NET_QUIC_QUIC_CLIENT_SESSION_H_ |
OLD | NEW |