Chromium Code Reviews| Index: net/quic/chromium/quic_chromium_client_stream.cc |
| diff --git a/net/quic/chromium/quic_chromium_client_stream.cc b/net/quic/chromium/quic_chromium_client_stream.cc |
| index ba3204b873af5d5ba0694ba7d3e2a3d841a14e46..5a3d996fb093f1e857d626442b5de31131d8a80a 100644 |
| --- a/net/quic/chromium/quic_chromium_client_stream.cc |
| +++ b/net/quic/chromium/quic_chromium_client_stream.cc |
| @@ -249,7 +249,7 @@ void QuicChromiumClientStream::OnError(int error) { |
| } |
| int QuicChromiumClientStream::Read(IOBuffer* buf, int buf_len) { |
| - if (sequencer()->IsClosed()) |
|
xunjieli
2016/10/07 17:15:35
This is changed to IsDoneReading() because before
|
| + if (IsDoneReading()) |
| return 0; // EOF |
| if (!HasBytesToRead()) |
| @@ -258,7 +258,12 @@ int QuicChromiumClientStream::Read(IOBuffer* buf, int buf_len) { |
| iovec iov; |
| iov.iov_base = buf->data(); |
| iov.iov_len = buf_len; |
| - return Readv(&iov, 1); |
| + size_t bytes_read = Readv(&iov, 1); |
| + // If no more body bytes and trailers are to be delivered, return |
| + // ERR_IO_PENDING now because onDataAvailable() will be called after trailers. |
| + if (bytes_read == 0 && !FinishedReadingTrailers()) |
|
mef
2016/10/07 17:28:31
What if there are no trailers?
xunjieli
2016/10/07 17:39:00
FinishedReadingTrailers() will return true if ther
mpw
2016/10/07 17:45:00
If there are no trailers, FinishedReadingTrailers(
|
| + return ERR_IO_PENDING; |
| + return bytes_read; |
| } |
| bool QuicChromiumClientStream::CanWrite(const CompletionCallback& callback) { |
| @@ -288,6 +293,8 @@ void QuicChromiumClientStream::NotifyDelegateOfHeadersComplete( |
| if (headers_delivered_) { |
| MarkTrailersConsumed(decompressed_trailers().length()); |
| MarkTrailersConsumed(); |
| + // Post an async task to notify delegate of the FIN flag. |
| + NotifyDelegateOfDataAvailableLater(); |
| net_log_.AddEvent( |
| NetLogEventType::QUIC_CHROMIUM_CLIENT_STREAM_READ_RESPONSE_TRAILERS, |
| base::Bind(&SpdyHeaderBlockNetLogCallback, &headers)); |