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

Unified Diff: net/quic/bidirectional_stream_quic_impl.cc

Issue 2077683002: Move the logic for delaying 0-RTT QUIC POST from the QuicStreamFactory (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@QuicHttpStream
Patch Set: Fix BidirectionalStreamQuicImpl Created 4 years, 6 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/bidirectional_stream_quic_impl.cc
diff --git a/net/quic/bidirectional_stream_quic_impl.cc b/net/quic/bidirectional_stream_quic_impl.cc
index 25154b40cf79bd238275053969faf8d8bf88333b..d8c106c29fd11c52ce8c22ca1b9704958f903fd3 100644
--- a/net/quic/bidirectional_stream_quic_impl.cc
+++ b/net/quic/bidirectional_stream_quic_impl.cc
@@ -33,6 +33,7 @@ BidirectionalStreamQuicImpl::BidirectionalStreamQuicImpl(
has_sent_headers_(false),
has_received_headers_(false),
send_request_headers_automatically_(true),
+ waiting_for_confirmation_(false),
weak_factory_(this) {
DCHECK(session_);
session_->AddObserver(this);
@@ -281,6 +282,8 @@ bool BidirectionalStreamQuicImpl::HasSendHeadersComplete() {
void BidirectionalStreamQuicImpl::OnCryptoHandshakeConfirmed() {
was_handshake_confirmed_ = true;
+ if (waiting_for_confirmation_)
+ StartStream();
}
void BidirectionalStreamQuicImpl::OnSessionClosed(
@@ -296,16 +299,24 @@ void BidirectionalStreamQuicImpl::OnStreamReady(int rv) {
DCHECK(rv == OK || !stream_);
if (rv == OK) {
stream_->SetDelegate(this);
- if (send_request_headers_automatically_) {
- SendRequestHeaders();
+ if (!was_handshake_confirmed_ && request_info_->method == "POST") {
xunjieli 2016/06/16 22:52:13 If |was_handshake_confirmed_| is false and method
xunjieli 2016/06/17 01:31:46 Ah, nvm. It won't happen. I was reading the code w
+ waiting_for_confirmation_ = true;
+ return;
}
- if (delegate_)
- delegate_->OnStreamReady(has_sent_headers_);
+ StartStream();
} else {
NotifyError(rv);
}
}
+void BidirectionalStreamQuicImpl::StartStream() {
+ if (send_request_headers_automatically_) {
+ SendRequestHeaders();
+ }
+ if (delegate_)
+ delegate_->OnStreamReady(has_sent_headers_);
+}
+
void BidirectionalStreamQuicImpl::OnSendDataComplete(int rv) {
DCHECK(rv == OK || !stream_);
if (rv == OK) {

Powered by Google App Engine
This is Rietveld 408576698