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

Unified Diff: net/http/http_network_transaction.cc

Issue 137493008: Retry HttpNetworkTransactions upon receipt of ERR_NETWORK_CHANGED during host resolution and … Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Flush task queue before restart Created 6 years, 11 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/http/http_network_transaction.cc
diff --git a/net/http/http_network_transaction.cc b/net/http/http_network_transaction.cc
index 8fb5a28f869c4781e7473c50517f1d319e4c6425..97a0c7378a22cad6aac8b681e178671f0f97cc0b 100644
--- a/net/http/http_network_transaction.cc
+++ b/net/http/http_network_transaction.cc
@@ -138,7 +138,9 @@ HttpNetworkTransaction::HttpNetworkTransaction(RequestPriority priority,
total_received_bytes_(0),
next_state_(STATE_NONE),
establishing_tunnel_(false),
- websocket_handshake_stream_base_create_helper_(NULL) {
+ websocket_handshake_stream_base_create_helper_(NULL),
+ num_automatic_retries_on_network_changes_(0),
+ weak_factory_(this) {
session->ssl_config_service()->GetSSLConfig(&server_ssl_config_);
if (session->http_stream_factory()->has_next_protos()) {
server_ssl_config_.next_protos =
@@ -745,6 +747,20 @@ int HttpNetworkTransaction::DoCreateStreamComplete(int result) {
// Return OK and let the caller read the proxy's error page
next_state_ = STATE_NONE;
return OK;
+ } else if (result == ERR_NETWORK_CHANGED &&
+ num_automatic_retries_on_network_changes_ <
+ request_->max_automatic_retries_on_network_changes_) {
+ // Try again to create the stream.
+ ++num_automatic_retries_on_network_changes_;
+ next_state_ = STATE_CREATE_STREAM;
+ // Retry after flushing all the current tasks which may include further
+ // network change observers that could trigger another ERR_NETWORK_CHANGED
+ // failure.
+ base::MessageLoop::current()->PostTask(
+ FROM_HERE,
+ base::Bind(&HttpNetworkTransaction::OnIOComplete,
+ weak_factory_.GetWeakPtr(), OK));
+ return ERR_IO_PENDING;
}
// Handle possible handshake errors that may have occurred if the stream

Powered by Google App Engine
This is Rietveld 408576698