Chromium Code Reviews| Index: net/spdy/buffered_spdy_framer.cc |
| diff --git a/net/spdy/buffered_spdy_framer.cc b/net/spdy/buffered_spdy_framer.cc |
| index 2fa15b8b9b860c2582e6ec1fb8cfc508af023bfa..5b61d6ba80ed191632a04f090d094923dbb14ab0 100644 |
| --- a/net/spdy/buffered_spdy_framer.cc |
| +++ b/net/spdy/buffered_spdy_framer.cc |
| @@ -8,6 +8,13 @@ |
| namespace net { |
| +namespace { |
| + |
| +// GOAWAY frame debug data is only buffered up to this many bytes. |
| +size_t kGoAwayDebugDataMaxSize = 1024; |
| + |
| +} // namespace |
| + |
| SpdyMajorVersion NextProtoToSpdyMajorVersion(NextProto next_proto) { |
| switch (next_proto) { |
| case kProtoDeprecatedSPDY2: |
| @@ -226,7 +233,24 @@ void BufferedSpdyFramer::OnRstStream(SpdyStreamId stream_id, |
| } |
| void BufferedSpdyFramer::OnGoAway(SpdyStreamId last_accepted_stream_id, |
| SpdyGoAwayStatus status) { |
| - visitor_->OnGoAway(last_accepted_stream_id, status); |
| + DCHECK(!goaway_fields_); |
| + goaway_fields_.reset(new GoAwayFields()); |
| + goaway_fields_->last_accepted_stream_id = last_accepted_stream_id; |
| + goaway_fields_->status = status; |
| +} |
| + |
| +bool BufferedSpdyFramer::OnGoAwayFrameData(const char* goaway_data, |
| + size_t len) { |
| + if (len > 0) { |
| + goaway_fields_->debug_data.append( |
| + goaway_data, std::min(len, kGoAwayDebugDataMaxSize - |
| + goaway_fields_->debug_data.size())); |
|
eroman
2015/10/07 17:00:51
This looks correct.
However when first reading it
Bence
2015/10/30 11:55:27
Done.
|
| + return true; |
| + } |
| + visitor_->OnGoAway(goaway_fields_->last_accepted_stream_id, |
| + goaway_fields_->status, goaway_fields_->debug_data); |
| + goaway_fields_.reset(); |
| + return true; |
| } |
| void BufferedSpdyFramer::OnWindowUpdate(SpdyStreamId stream_id, |
| @@ -354,8 +378,9 @@ SpdyFrame* BufferedSpdyFramer::CreatePingFrame(SpdyPingId unique_id, |
| // TODO(jgraettinger): Eliminate uses of this method (prefer SpdyGoAwayIR). |
| SpdyFrame* BufferedSpdyFramer::CreateGoAway( |
| SpdyStreamId last_accepted_stream_id, |
| - SpdyGoAwayStatus status) const { |
| - SpdyGoAwayIR go_ir(last_accepted_stream_id, status, ""); |
| + SpdyGoAwayStatus status, |
| + base::StringPiece debug_data) const { |
| + SpdyGoAwayIR go_ir(last_accepted_stream_id, status, debug_data); |
| return spdy_framer_.SerializeGoAway(go_ir); |
| } |