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

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: Created 5 years, 9 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/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 6e544341a484bc0146e968cea58a39f7a6f120ea..b500e42b6d3339e26ea66258c50867effb4cb61c 100644
--- a/net/socket/transport_client_socket_pool.cc
+++ b/net/socket/transport_client_socket_pool.cc
@@ -200,10 +200,14 @@ 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),
+ connect_result_(OK) {
helper_.SetOnIOComplete(this);
}
@@ -227,6 +231,21 @@ LoadState TransportConnectJob::GetLoadState() const {
return LOAD_STATE_IDLE;
}
+void TransportConnectJob::GetAdditionalErrorState(ClientSocketHandle* handle) {
+ // 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.
+ if (connect_result_ != OK) {
Ryan Hamilton 2015/03/12 20:06:04 nit: early return for the win if (connect_result_
Deprecated (see juliatuttle) 2015/03/16 15:53:54 Done.
+ DCHECK_LT(0u, helper_.addresses().size());
+ ClientSocketHandle::ConnectionAttempt attempt;
+ attempt.endpoint = helper_.addresses().back();
+ attempt.result = connect_result_;
Ryan Hamilton 2015/03/12 20:06:04 consider adding a 2 arg constructor to ConnectionA
Deprecated (see juliatuttle) 2015/03/16 15:53:54 Done.
+ std::vector<ClientSocketHandle::ConnectionAttempt> attempts;
Ryan Hamilton 2015/03/12 20:06:04 Consider using a typdef to make this expression so
Deprecated (see juliatuttle) 2015/03/16 15:53:54 Done.
+ attempts.push_back(attempt);
+ handle->set_connection_attempts(attempts);
+ }
+}
+
// static
void TransportConnectJob::MakeAddressListStartWithIPv4(AddressList* list) {
for (AddressList::iterator i = list->begin(); i != list->end(); ++i) {
@@ -390,6 +409,8 @@ int TransportConnectJob::DoTransportConnectComplete(int result) {
fallback_addresses_.reset();
}
+ connect_result_ = result;
+
return result;
}
« net/socket/ssl_client_socket_pool.cc ('K') | « net/socket/transport_client_socket_pool.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698