Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(467)

Unified Diff: net/quic/chromium/quic_chromium_client_stream.cc

Issue 2409273002: QuicChromiumClientStream handle Read() after trailers are received but not yet delivered (Closed)
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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())
+ 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())
+ 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));
« no previous file with comments | « net/quic/chromium/bidirectional_stream_quic_impl_unittest.cc ('k') | net/quic/chromium/quic_chromium_client_stream_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698