summaryrefslogtreecommitdiffstats
path: root/net/socket/tcp_client_socket_libevent.cc
diff options
context:
space:
mode:
authoreroman@chromium.org <eroman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-10 05:29:51 +0000
committereroman@chromium.org <eroman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-10 05:29:51 +0000
commit4ea13f34905465cbb84b881046f55eff2f918a99 (patch)
treeee489186c0665b15aee371d6194a304ff98bae0d /net/socket/tcp_client_socket_libevent.cc
parentf8554294db9c534f2cf4c0069bd705dd490f9d67 (diff)
downloadchromium_src-4ea13f34905465cbb84b881046f55eff2f918a99.zip
chromium_src-4ea13f34905465cbb84b881046f55eff2f918a99.tar.gz
chromium_src-4ea13f34905465cbb84b881046f55eff2f918a99.tar.bz2
Give a more specific error code when connect() fails synchronously with EHOSTDOWN on posix systems.
Before it would give ERR_FAILED, now it fails with ERR_ADDRESS_UNREACHABLE. Moreover, any unmapped error from connect() will map to ERR_CONNECTION_FAILED rather than ERR_FAILED. BUG=55009 Review URL: http://codereview.chromium.org/3303022 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@59053 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/socket/tcp_client_socket_libevent.cc')
-rw-r--r--net/socket/tcp_client_socket_libevent.cc3
1 files changed, 2 insertions, 1 deletions
diff --git a/net/socket/tcp_client_socket_libevent.cc b/net/socket/tcp_client_socket_libevent.cc
index 63bf149..2389419 100644
--- a/net/socket/tcp_client_socket_libevent.cc
+++ b/net/socket/tcp_client_socket_libevent.cc
@@ -69,6 +69,7 @@ int MapPosixError(int os_error) {
case ECONNREFUSED:
return ERR_CONNECTION_REFUSED;
case EHOSTUNREACH:
+ case EHOSTDOWN:
case ENETUNREACH:
return ERR_ADDRESS_UNREACHABLE;
case EADDRNOTAVAIL:
@@ -207,7 +208,7 @@ int TCPClientSocketLibevent::DoConnect() {
// Check if the connect() failed synchronously.
connect_os_error_ = errno;
if (connect_os_error_ != EINPROGRESS)
- return MapPosixError(connect_os_error_);
+ return MapConnectError(connect_os_error_);
// Otherwise the connect() is going to complete asynchronously, so watch
// for its completion.