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

Unified Diff: net/socket/transport_client_socket_pool.cc

Issue 1006643002: Plumb connection attempts from (non-proxy) ConnectJobs to HttpNetworkTransaction. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase, resolve conflict Created 5 years, 8 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
« no previous file with comments | « net/socket/transport_client_socket_pool.h ('k') | net/socket/transport_client_socket_pool_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/socket/transport_client_socket_pool.cc
diff --git a/net/socket/transport_client_socket_pool.cc b/net/socket/transport_client_socket_pool.cc
index 5263e7000c991146e864cc6c5429c351ceb7add5..f2d124788345989d0abcdd41a83bc0e6df43b4a9 100644
--- a/net/socket/transport_client_socket_pool.cc
+++ b/net/socket/transport_client_socket_pool.cc
@@ -201,10 +201,15 @@ TransportConnectJob::TransportConnectJob(
HostResolver* host_resolver,
Delegate* delegate,
NetLog* net_log)
- : ConnectJob(group_name, timeout_duration, priority, delegate,
+ : ConnectJob(group_name,
+ timeout_duration,
+ priority,
+ delegate,
BoundNetLog::Make(net_log, NetLog::SOURCE_CONNECT_JOB)),
helper_(params, client_socket_factory, host_resolver, &connect_timing_),
- interval_between_connects_(CONNECT_INTERVAL_GT_20MS) {
+ interval_between_connects_(CONNECT_INTERVAL_GT_20MS),
+ resolve_result_(OK),
+ connect_result_(OK) {
helper_.SetOnIOComplete(this);
}
@@ -228,6 +233,23 @@ LoadState TransportConnectJob::GetLoadState() const {
return LOAD_STATE_IDLE;
}
+void TransportConnectJob::GetAdditionalErrorState(ClientSocketHandle* handle) {
+ // If hostname resolution failed, record an empty endpoint and the result.
+ // If the actual socket Connect call failed, record the result and the last
+ // address attempted.
+ // TODO(ttuttle): Plumb into the socket layer and record *all* attempts.
+ ConnectionAttempts attempts;
+ if (resolve_result_ != OK) {
+ DCHECK_EQ(0u, helper_.addresses().size());
+ attempts.push_back(ConnectionAttempt(IPEndPoint(), resolve_result_));
+ } else if (connect_result_ != OK) {
+ DCHECK_LT(0u, helper_.addresses().size());
+ attempts.push_back(
+ ConnectionAttempt(helper_.addresses().back(), connect_result_));
+ }
+ handle->set_connection_attempts(attempts);
+}
+
// static
void TransportConnectJob::MakeAddressListStartWithIPv4(AddressList* list) {
for (AddressList::iterator i = list->begin(); i != list->end(); ++i) {
@@ -248,6 +270,7 @@ int TransportConnectJob::DoResolveHost() {
}
int TransportConnectJob::DoResolveHostComplete(int result) {
+ resolve_result_ = result;
return helper_.DoResolveHostComplete(result, net_log());
}
@@ -360,6 +383,8 @@ int TransportConnectJob::DoTransportConnectComplete(int result) {
fallback_addresses_.reset();
}
+ connect_result_ = result;
+
return result;
}
« no previous file with comments | « net/socket/transport_client_socket_pool.h ('k') | net/socket/transport_client_socket_pool_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698