summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwillchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-07 18:58:37 +0000
committerwillchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-07 18:58:37 +0000
commitc53976d541527d07f2e71f32abf6646d73071b2e (patch)
tree7d1e88ac366d9b8a50821684d655c520696cd123
parent35506359934707a1dc47e0b26684a145835dd9c3 (diff)
downloadchromium_src-c53976d541527d07f2e71f32abf6646d73071b2e.zip
chromium_src-c53976d541527d07f2e71f32abf6646d73071b2e.tar.gz
chromium_src-c53976d541527d07f2e71f32abf6646d73071b2e.tar.bz2
Add a new net::Error value: ERR_CONNECTION_TIMED_OUT.
TEST=net_unittests BUG=none Review URL: http://codereview.chromium.org/159904 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@22746 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/renderer/localized_error.cc7
-rw-r--r--chrome/renderer/render_view.cc5
-rw-r--r--net/base/net_error_list.h3
-rw-r--r--net/socket/tcp_client_socket_libevent.cc13
-rw-r--r--net/socket/tcp_client_socket_win.cc13
5 files changed, 34 insertions, 7 deletions
diff --git a/chrome/renderer/localized_error.cc b/chrome/renderer/localized_error.cc
index ab47125..e95e937 100644
--- a/chrome/renderer/localized_error.cc
+++ b/chrome/renderer/localized_error.cc
@@ -46,6 +46,13 @@ WebErrorNetErrorMap net_error_options[] = {
IDS_ERRORPAGES_DETAILS_TIMED_OUT,
SUGGEST_RELOAD,
},
+ {net::ERR_CONNECTION_TIMED_OUT,
+ IDS_ERRORPAGES_TITLE_NOT_AVAILABLE,
+ IDS_ERRORPAGES_HEADING_NOT_AVAILABLE,
+ IDS_ERRORPAGES_SUMMARY_NOT_AVAILABLE,
+ IDS_ERRORPAGES_DETAILS_TIMED_OUT,
+ SUGGEST_RELOAD,
+ },
{net::ERR_CONNECTION_FAILED,
IDS_ERRORPAGES_TITLE_NOT_AVAILABLE,
IDS_ERRORPAGES_HEADING_NOT_AVAILABLE,
diff --git a/chrome/renderer/render_view.cc b/chrome/renderer/render_view.cc
index 0b9898c..e82f7fc 100644
--- a/chrome/renderer/render_view.cc
+++ b/chrome/renderer/render_view.cc
@@ -2922,14 +2922,13 @@ bool RenderView::MaybeLoadAlternateErrorPage(WebFrame* frame,
return false;
// Use the alternate error page service if this is a DNS failure or
- // connection failure. ERR_CONNECTION_FAILED can be dropped once we no
- // longer use winhttp.
+ // connection failure.
int ec = error.reason;
if (ec != net::ERR_NAME_NOT_RESOLVED &&
ec != net::ERR_CONNECTION_FAILED &&
ec != net::ERR_CONNECTION_REFUSED &&
ec != net::ERR_ADDRESS_UNREACHABLE &&
- ec != net::ERR_TIMED_OUT)
+ ec != net::ERR_CONNECTION_TIMED_OUT)
return false;
const GURL& error_page_url = GetAlternateErrorPageURL(error.unreachableURL,
diff --git a/net/base/net_error_list.h b/net/base/net_error_list.h
index d0f91c4..cd9ba06 100644
--- a/net/base/net_error_list.h
+++ b/net/base/net_error_list.h
@@ -109,6 +109,9 @@ NET_ERROR(CERT_ERROR_IN_SSL_RENEGOTIATION, -116)
// The SSL handshake failed because of a bad or missing client certificate.
NET_ERROR(BAD_SSL_CLIENT_AUTH_CERT, -117)
+// A connection attempt timed out.
+NET_ERROR(CONNECTION_TIMED_OUT, -118)
+
// Certificate error codes
//
// The values of certificate error codes must be consecutive.
diff --git a/net/socket/tcp_client_socket_libevent.cc b/net/socket/tcp_client_socket_libevent.cc
index a8e4387..c03473a 100644
--- a/net/socket/tcp_client_socket_libevent.cc
+++ b/net/socket/tcp_client_socket_libevent.cc
@@ -67,6 +67,15 @@ int MapPosixError(int err) {
}
}
+int MapConnectError(int err) {
+ switch (err) {
+ case ETIMEDOUT:
+ return ERR_CONNECTION_TIMED_OUT;
+ default:
+ return MapPosixError(err);
+ }
+}
+
} // namespace
//-----------------------------------------------------------------------------
@@ -115,7 +124,7 @@ int TCPClientSocketLibevent::Connect(CompletionCallback* callback) {
DLOG(INFO) << "connect failed: " << errno;
close(socket_);
socket_ = kInvalidSocket;
- return MapPosixError(errno);
+ return MapConnectError(errno);
}
// Initialize write_socket_watcher_ and link it to our MessagePump.
@@ -309,7 +318,7 @@ void TCPClientSocketLibevent::DidCompleteConnect() {
current_ai_ = next;
result = Connect(write_callback_);
} else {
- result = MapPosixError(error_code);
+ result = MapConnectError(error_code);
bool ok = write_socket_watcher_.StopWatchingFileDescriptor();
DCHECK(ok);
waiting_connect_ = false;
diff --git a/net/socket/tcp_client_socket_win.cc b/net/socket/tcp_client_socket_win.cc
index aa0e68c..de3cac6 100644
--- a/net/socket/tcp_client_socket_win.cc
+++ b/net/socket/tcp_client_socket_win.cc
@@ -76,6 +76,15 @@ int MapWinsockError(DWORD err) {
}
}
+int MapConnectError(DWORD err) {
+ switch (err) {
+ case WSAETIMEDOUT:
+ return ERR_CONNECTION_TIMED_OUT;
+ default:
+ return MapWinsockError(err);
+ }
+}
+
} // namespace
//-----------------------------------------------------------------------------
@@ -270,7 +279,7 @@ int TCPClientSocketWin::Connect(CompletionCallback* callback) {
DWORD err = WSAGetLastError();
if (err != WSAEWOULDBLOCK) {
LOG(ERROR) << "connect failed: " << err;
- return MapWinsockError(err);
+ return MapConnectError(err);
}
}
@@ -539,7 +548,7 @@ void TCPClientSocketWin::DidCompleteConnect() {
current_ai_ = next;
result = Connect(read_callback_);
} else {
- result = MapWinsockError(error_code);
+ result = MapConnectError(error_code);
}
} else {
NOTREACHED();