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 <algorithm> | 7 #include <algorithm> |
8 #include <map> | 8 #include <map> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 2267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2278 | 2278 |
2279 if (availability_state_ == STATE_CLOSED) | 2279 if (availability_state_ == STATE_CLOSED) |
2280 return; | 2280 return; |
2281 | 2281 |
2282 net_log_.AddEvent(NetLog::TYPE_SPDY_SESSION_GOAWAY, | 2282 net_log_.AddEvent(NetLog::TYPE_SPDY_SESSION_GOAWAY, |
2283 base::Bind(&NetLogSpdyGoAwayCallback, | 2283 base::Bind(&NetLogSpdyGoAwayCallback, |
2284 last_accepted_stream_id, | 2284 last_accepted_stream_id, |
2285 active_streams_.size(), | 2285 active_streams_.size(), |
2286 unclaimed_pushed_streams_.size(), | 2286 unclaimed_pushed_streams_.size(), |
2287 status)); | 2287 status)); |
| 2288 GoAway(last_accepted_stream_id, ERR_ABORTED); |
| 2289 } |
| 2290 |
| 2291 void SpdySession::GoAway(SpdyStreamId last_accepted_stream_id, Error err) { |
2288 if (availability_state_ < STATE_GOING_AWAY) { | 2292 if (availability_state_ < STATE_GOING_AWAY) { |
2289 availability_state_ = STATE_GOING_AWAY; | 2293 availability_state_ = STATE_GOING_AWAY; |
2290 // |pool_| will be NULL when |InitializeWithSocket()| is in the | 2294 // |pool_| will be NULL when |InitializeWithSocket()| is in the |
2291 // call stack. | 2295 // call stack. |
2292 if (pool_) | 2296 if (pool_) |
2293 pool_->MakeSessionUnavailable(GetWeakPtr()); | 2297 pool_->MakeSessionUnavailable(GetWeakPtr()); |
2294 } | 2298 } |
2295 StartGoingAway(last_accepted_stream_id, ERR_ABORTED); | 2299 StartGoingAway(last_accepted_stream_id, err); |
2296 // This is to handle the case when we already don't have any active | 2300 // This is to handle the case when we already don't have any active |
2297 // streams (i.e., StartGoingAway() did nothing). Otherwise, we have | 2301 // streams (i.e., StartGoingAway() did nothing). Otherwise, we have |
2298 // active streams and so the last one being closed will finish the | 2302 // active streams and so the last one being closed will finish the |
2299 // going away process (see DeleteStream()). | 2303 // going away process (see DeleteStream()). |
2300 MaybeFinishGoingAway(); | 2304 MaybeFinishGoingAway(); |
2301 } | 2305 } |
2302 | 2306 |
| 2307 void SpdySession::Deprecate(Error err) { |
| 2308 SpdyStreamId highest_active_stream_id = 0; |
| 2309 if (active_streams_.size()) |
| 2310 highest_active_stream_id = active_streams_.rbegin()->first; |
| 2311 GoAway(highest_active_stream_id, err); |
| 2312 } |
| 2313 |
2303 void SpdySession::OnPing(uint32 unique_id) { | 2314 void SpdySession::OnPing(uint32 unique_id) { |
2304 CHECK(in_io_loop_); | 2315 CHECK(in_io_loop_); |
2305 | 2316 |
2306 if (availability_state_ == STATE_CLOSED) | 2317 if (availability_state_ == STATE_CLOSED) |
2307 return; | 2318 return; |
2308 | 2319 |
2309 net_log_.AddEvent( | 2320 net_log_.AddEvent( |
2310 NetLog::TYPE_SPDY_SESSION_PING, | 2321 NetLog::TYPE_SPDY_SESSION_PING, |
2311 base::Bind(&NetLogSpdyPingCallback, unique_id, "received")); | 2322 base::Bind(&NetLogSpdyPingCallback, unique_id, "received")); |
2312 | 2323 |
(...skipping 633 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2946 if (!queue->empty()) { | 2957 if (!queue->empty()) { |
2947 SpdyStreamId stream_id = queue->front(); | 2958 SpdyStreamId stream_id = queue->front(); |
2948 queue->pop_front(); | 2959 queue->pop_front(); |
2949 return stream_id; | 2960 return stream_id; |
2950 } | 2961 } |
2951 } | 2962 } |
2952 return 0; | 2963 return 0; |
2953 } | 2964 } |
2954 | 2965 |
2955 } // namespace net | 2966 } // namespace net |
OLD | NEW |