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/spdy/spdy_session.h" | 5 #include "net/spdy/spdy_session.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/memory/linked_ptr.h" | 9 #include "base/memory/linked_ptr.h" |
10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
220 | 220 |
221 DISALLOW_COPY_AND_ASSIGN(NetLogSpdyGoAwayParameter); | 221 DISALLOW_COPY_AND_ASSIGN(NetLogSpdyGoAwayParameter); |
222 }; | 222 }; |
223 | 223 |
224 } // namespace | 224 } // namespace |
225 | 225 |
226 // static | 226 // static |
227 bool SpdySession::use_ssl_ = true; | 227 bool SpdySession::use_ssl_ = true; |
228 | 228 |
229 // static | 229 // static |
230 bool SpdySession::use_flow_control_ = false; | 230 SpdySession::FlowControl SpdySession::use_flow_control_ = |
231 SpdySession::kUninitialized; | |
231 | 232 |
232 // static | 233 // static |
233 size_t SpdySession::init_max_concurrent_streams_ = 10; | 234 size_t SpdySession::init_max_concurrent_streams_ = 10; |
234 | 235 |
235 // static | 236 // static |
236 size_t SpdySession::max_concurrent_stream_limit_ = 256; | 237 size_t SpdySession::max_concurrent_stream_limit_ = 256; |
237 | 238 |
238 // static | 239 // static |
239 bool SpdySession::enable_ping_based_connection_checking_ = true; | 240 bool SpdySession::enable_ping_based_connection_checking_ = true; |
240 | 241 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
275 bytes_received_(0), | 276 bytes_received_(0), |
276 sent_settings_(false), | 277 sent_settings_(false), |
277 received_settings_(false), | 278 received_settings_(false), |
278 stalled_streams_(0), | 279 stalled_streams_(0), |
279 pings_in_flight_(0), | 280 pings_in_flight_(0), |
280 next_ping_id_(1), | 281 next_ping_id_(1), |
281 received_data_time_(base::TimeTicks::Now()), | 282 received_data_time_(base::TimeTicks::Now()), |
282 trailing_ping_pending_(false), | 283 trailing_ping_pending_(false), |
283 check_ping_status_pending_(false), | 284 check_ping_status_pending_(false), |
284 need_to_send_ping_(false), | 285 need_to_send_ping_(false), |
285 flow_control_(use_flow_control_), | 286 flow_control_(false), |
286 initial_send_window_size_(spdy::kSpdyStreamInitialWindowSize), | 287 initial_send_window_size_(spdy::kSpdyStreamInitialWindowSize), |
287 initial_recv_window_size_(spdy::kSpdyStreamInitialWindowSize), | 288 initial_recv_window_size_(spdy::kSpdyStreamInitialWindowSize), |
288 net_log_(BoundNetLog::Make(net_log, NetLog::SOURCE_SPDY_SESSION)), | 289 net_log_(BoundNetLog::Make(net_log, NetLog::SOURCE_SPDY_SESSION)), |
289 verify_domain_authentication_(verify_domain_authentication) { | 290 verify_domain_authentication_(verify_domain_authentication) { |
290 DCHECK(HttpStreamFactory::spdy_enabled()); | 291 DCHECK(HttpStreamFactory::spdy_enabled()); |
291 net_log_.BeginEvent( | 292 net_log_.BeginEvent( |
292 NetLog::TYPE_SPDY_SESSION, | 293 NetLog::TYPE_SPDY_SESSION, |
293 make_scoped_refptr( | 294 make_scoped_refptr( |
294 new NetLogSpdySessionParameter(host_port_proxy_pair_))); | 295 new NetLogSpdySessionParameter(host_port_proxy_pair_))); |
295 | 296 |
297 // In unit tests, check if use_flow_control_ is enabled or disabled. | |
298 if (use_flow_control_ == SpdySession::kEnableFlowControl) | |
299 flow_control_ = true; | |
300 | |
296 // TODO(mbelshe): consider randomization of the stream_hi_water_mark. | 301 // TODO(mbelshe): consider randomization of the stream_hi_water_mark. |
297 | 302 |
298 buffered_spdy_framer_.set_visitor(this); | 303 buffered_spdy_framer_.set_visitor(this); |
299 | 304 |
300 SendSettings(); | 305 SendSettings(); |
301 } | 306 } |
302 | 307 |
303 SpdySession::PendingCreateStream::~PendingCreateStream() {} | 308 SpdySession::PendingCreateStream::~PendingCreateStream() {} |
304 | 309 |
305 SpdySession::CallbackResultPair::~CallbackResultPair() {} | 310 SpdySession::CallbackResultPair::~CallbackResultPair() {} |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
337 | 342 |
338 state_ = CONNECTED; | 343 state_ = CONNECTED; |
339 connection_.reset(connection); | 344 connection_.reset(connection); |
340 is_secure_ = is_secure; | 345 is_secure_ = is_secure; |
341 certificate_error_code_ = certificate_error_code; | 346 certificate_error_code_ = certificate_error_code; |
342 | 347 |
343 if (is_secure_) { | 348 if (is_secure_) { |
344 SSLClientSocket* ssl_socket = | 349 SSLClientSocket* ssl_socket = |
345 reinterpret_cast<SSLClientSocket*>(connection_->socket()); | 350 reinterpret_cast<SSLClientSocket*>(connection_->socket()); |
346 DCHECK(ssl_socket); | 351 DCHECK(ssl_socket); |
347 if (ssl_socket->protocol_negotiated() == SSLClientSocket::kProtoSPDY21) | 352 |
353 // For SPDY 2.1 and above versions, flow control is enabled by default and | |
354 // for all other protocols, flow control is disabled by default. | |
wtc
2012/01/26 22:03:25
Nit: for all other protocols => for older versions
ramant (doing other things)
2012/01/26 22:39:21
Done.
| |
355 if (ssl_socket->protocol_negotiated() >= SSLClientSocket::kProtoSPDY21) { | |
348 flow_control_ = true; | 356 flow_control_ = true; |
357 // In unit tests, check if use_flow_control_ is enabled or disabled. | |
358 if (use_flow_control_ == SpdySession::kDisableFlowControl) | |
359 flow_control_ = false; | |
wtc
2012/01/26 22:03:25
Nit: you can just set flow_control_ to the logical
ramant (doing other things)
2012/01/26 22:39:21
Done.
| |
360 | |
361 } else { | |
362 flow_control_ = false; | |
363 // In unit tests, check if use_flow_control_ is enabled or disabled. | |
364 if (use_flow_control_ == SpdySession::kEnableFlowControl) | |
365 flow_control_ = true; | |
wtc
2012/01/26 22:03:25
Similarly, you can just say
flow_control_ = (use
ramant (doing other things)
2012/01/26 22:39:21
Done.
| |
366 } | |
349 } | 367 } |
350 | 368 |
351 // Write out any data that we might have to send, such as the settings frame. | 369 // Write out any data that we might have to send, such as the settings frame. |
352 WriteSocketLater(); | 370 WriteSocketLater(); |
353 net::Error error = ReadSocket(); | 371 net::Error error = ReadSocket(); |
354 if (error == ERR_IO_PENDING) | 372 if (error == ERR_IO_PENDING) |
355 return OK; | 373 return OK; |
356 return error; | 374 return error; |
357 } | 375 } |
358 | 376 |
(...skipping 1392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1751 if (it == pending_callback_map_.end()) | 1769 if (it == pending_callback_map_.end()) |
1752 return; | 1770 return; |
1753 | 1771 |
1754 CompletionCallback callback = it->second.callback; | 1772 CompletionCallback callback = it->second.callback; |
1755 int result = it->second.result; | 1773 int result = it->second.result; |
1756 pending_callback_map_.erase(it); | 1774 pending_callback_map_.erase(it); |
1757 callback.Run(result); | 1775 callback.Run(result); |
1758 } | 1776 } |
1759 | 1777 |
1760 } // namespace net | 1778 } // namespace net |
OLD | NEW |