summaryrefslogtreecommitdiffstats
path: root/net/socket/tcp_client_socket_win.cc
diff options
context:
space:
mode:
authoreroman@chromium.org <eroman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-09 00:35:47 +0000
committereroman@chromium.org <eroman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-09 00:35:47 +0000
commit2d3b7766506922d50aa2585c1a596350d57ad238 (patch)
treecb85915944eba0f47577c660682b4868780e816c /net/socket/tcp_client_socket_win.cc
parentff9cebb3f64df1c0c779a8a60daee57da7f9b667 (diff)
downloadchromium_src-2d3b7766506922d50aa2585c1a596350d57ad238.zip
chromium_src-2d3b7766506922d50aa2585c1a596350d57ad238.tar.gz
chromium_src-2d3b7766506922d50aa2585c1a596350d57ad238.tar.bz2
Return ERR_INTERNET_DISCONNECTED in place of ERR_NAME_NOT_RESOLVED and ERR_ADDRESS_UNREACHABLE, when the user is in offline mode.
This initial changelist includes the implementation just for Windows. BUG=53473 TEST=unplug network cable, try to connect to www.google.com --> should get the error ERR_INTERNET_DISCONNECTED. Next, try connecting directly to an IP address --> should get the error ERR_INTERNET_DISCONNECTED. Review URL: http://codereview.chromium.org/3634002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@62050 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/socket/tcp_client_socket_win.cc')
-rw-r--r--net/socket/tcp_client_socket_win.cc8
1 files changed, 8 insertions, 0 deletions
diff --git a/net/socket/tcp_client_socket_win.cc b/net/socket/tcp_client_socket_win.cc
index e6d6b77..0275f18 100644
--- a/net/socket/tcp_client_socket_win.cc
+++ b/net/socket/tcp_client_socket_win.cc
@@ -16,6 +16,7 @@
#include "net/base/net_errors.h"
#include "net/base/net_log.h"
#include "net/base/net_util.h"
+#include "net/base/network_change_notifier.h"
#include "net/base/sys_addrinfo.h"
#include "net/base/winsock_init.h"
@@ -109,6 +110,13 @@ int MapConnectError(int os_error) {
int net_error = MapWinsockError(os_error);
if (net_error == ERR_FAILED)
return ERR_CONNECTION_FAILED; // More specific than ERR_FAILED.
+
+ // Give a more specific error when the user is offline.
+ if (net_error == ERR_ADDRESS_UNREACHABLE &&
+ NetworkChangeNotifier::IsOffline()) {
+ return ERR_INTERNET_DISCONNECTED;
+ }
+
return net_error;
}
}