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 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
250 dict->SetString("type", type); | 250 dict->SetString("type", type); |
251 dict->SetBoolean("is_ack", is_ack); | 251 dict->SetBoolean("is_ack", is_ack); |
252 return dict.Pass(); | 252 return dict.Pass(); |
253 } | 253 } |
254 | 254 |
255 scoped_ptr<base::Value> NetLogSpdyGoAwayCallback( | 255 scoped_ptr<base::Value> NetLogSpdyGoAwayCallback( |
256 SpdyStreamId last_stream_id, | 256 SpdyStreamId last_stream_id, |
257 int active_streams, | 257 int active_streams, |
258 int unclaimed_streams, | 258 int unclaimed_streams, |
259 SpdyGoAwayStatus status, | 259 SpdyGoAwayStatus status, |
260 NetLogCaptureMode /* capture_mode */) { | 260 StringPiece debug_data, |
261 NetLogCaptureMode capture_mode) { | |
261 scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); | 262 scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); |
262 dict->SetInteger("last_accepted_stream_id", | 263 dict->SetInteger("last_accepted_stream_id", |
263 static_cast<int>(last_stream_id)); | 264 static_cast<int>(last_stream_id)); |
264 dict->SetInteger("active_streams", active_streams); | 265 dict->SetInteger("active_streams", active_streams); |
265 dict->SetInteger("unclaimed_streams", unclaimed_streams); | 266 dict->SetInteger("unclaimed_streams", unclaimed_streams); |
266 dict->SetInteger("status", static_cast<int>(status)); | 267 dict->SetInteger("status", static_cast<int>(status)); |
268 dict->SetString("goaway_debug_data", | |
Ryan Hamilton
2015/10/05 21:17:55
nit: I think "goaway_" is redundant.
Bence
2015/10/06 15:18:57
You are right. I was using it to make it easier t
| |
269 ElideGoAwayDebugDataForNetLog(capture_mode, debug_data)); | |
267 return dict.Pass(); | 270 return dict.Pass(); |
268 } | 271 } |
269 | 272 |
270 scoped_ptr<base::Value> NetLogSpdyPushPromiseReceivedCallback( | 273 scoped_ptr<base::Value> NetLogSpdyPushPromiseReceivedCallback( |
271 const SpdyHeaderBlock* headers, | 274 const SpdyHeaderBlock* headers, |
272 SpdyStreamId stream_id, | 275 SpdyStreamId stream_id, |
273 SpdyStreamId promised_stream_id, | 276 SpdyStreamId promised_stream_id, |
274 NetLogCaptureMode capture_mode) { | 277 NetLogCaptureMode capture_mode) { |
275 scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); | 278 scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); |
276 dict->Set("headers", SpdyHeaderBlockToListValue(*headers, capture_mode)); | 279 dict->Set("headers", SpdyHeaderBlockToListValue(*headers, capture_mode)); |
(...skipping 2168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2445 it->second.stream->LogStreamError( | 2448 it->second.stream->LogStreamError( |
2446 ERR_SPDY_PROTOCOL_ERROR, | 2449 ERR_SPDY_PROTOCOL_ERROR, |
2447 base::StringPrintf("SPDY stream closed with status: %d", status)); | 2450 base::StringPrintf("SPDY stream closed with status: %d", status)); |
2448 // TODO(mbelshe): Map from Spdy-protocol errors to something sensical. | 2451 // TODO(mbelshe): Map from Spdy-protocol errors to something sensical. |
2449 // For now, it doesn't matter much - it is a protocol error. | 2452 // For now, it doesn't matter much - it is a protocol error. |
2450 CloseActiveStreamIterator(it, ERR_SPDY_PROTOCOL_ERROR); | 2453 CloseActiveStreamIterator(it, ERR_SPDY_PROTOCOL_ERROR); |
2451 } | 2454 } |
2452 } | 2455 } |
2453 | 2456 |
2454 void SpdySession::OnGoAway(SpdyStreamId last_accepted_stream_id, | 2457 void SpdySession::OnGoAway(SpdyStreamId last_accepted_stream_id, |
2455 SpdyGoAwayStatus status) { | 2458 SpdyGoAwayStatus status, |
2459 StringPiece debug_data) { | |
2456 CHECK(in_io_loop_); | 2460 CHECK(in_io_loop_); |
2457 | 2461 |
2458 // TODO(jgraettinger): UMA histogram on |status|. | 2462 // TODO(jgraettinger): UMA histogram on |status|. |
2459 | 2463 |
2460 net_log_.AddEvent(NetLog::TYPE_HTTP2_SESSION_GOAWAY, | 2464 net_log_.AddEvent( |
2461 base::Bind(&NetLogSpdyGoAwayCallback, | 2465 NetLog::TYPE_HTTP2_SESSION_GOAWAY, |
2462 last_accepted_stream_id, active_streams_.size(), | 2466 base::Bind(&NetLogSpdyGoAwayCallback, last_accepted_stream_id, |
2463 unclaimed_pushed_streams_.size(), status)); | 2467 active_streams_.size(), unclaimed_pushed_streams_.size(), |
2468 status, debug_data)); | |
2464 MakeUnavailable(); | 2469 MakeUnavailable(); |
2465 if (status == GOAWAY_HTTP_1_1_REQUIRED) { | 2470 if (status == GOAWAY_HTTP_1_1_REQUIRED) { |
2466 // TODO(bnc): Record histogram with number of open streams capped at 50. | 2471 // TODO(bnc): Record histogram with number of open streams capped at 50. |
2467 DoDrainSession(ERR_HTTP_1_1_REQUIRED, "HTTP_1_1_REQUIRED for stream."); | 2472 DoDrainSession(ERR_HTTP_1_1_REQUIRED, "HTTP_1_1_REQUIRED for stream."); |
2468 } else { | 2473 } else { |
2469 StartGoingAway(last_accepted_stream_id, ERR_ABORTED); | 2474 StartGoingAway(last_accepted_stream_id, ERR_ABORTED); |
2470 } | 2475 } |
2471 // This is to handle the case when we already don't have any active | 2476 // This is to handle the case when we already don't have any active |
2472 // streams (i.e., StartGoingAway() did nothing). Otherwise, we have | 2477 // streams (i.e., StartGoingAway() did nothing). Otherwise, we have |
2473 // active streams and so the last one being closed will finish the | 2478 // active streams and so the last one being closed will finish the |
(...skipping 786 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3260 if (!queue->empty()) { | 3265 if (!queue->empty()) { |
3261 SpdyStreamId stream_id = queue->front(); | 3266 SpdyStreamId stream_id = queue->front(); |
3262 queue->pop_front(); | 3267 queue->pop_front(); |
3263 return stream_id; | 3268 return stream_id; |
3264 } | 3269 } |
3265 } | 3270 } |
3266 return 0; | 3271 return 0; |
3267 } | 3272 } |
3268 | 3273 |
3269 } // namespace net | 3274 } // namespace net |
OLD | NEW |