summaryrefslogtreecommitdiffstats
path: root/chrome/browser/sync/notifier
diff options
context:
space:
mode:
authorzork@google.com <zork@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-11 00:43:53 +0000
committerzork@google.com <zork@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-11 00:43:53 +0000
commit81cb4bb9dc17206a1baaea906c73e7b735f181db (patch)
tree6d022431923733cdca5dc7c1061d8d6f9cdb62cd /chrome/browser/sync/notifier
parent58b42f2299482ea0deaf88f649804cbb6be8bc6a (diff)
downloadchromium_src-81cb4bb9dc17206a1baaea906c73e7b735f181db.zip
chromium_src-81cb4bb9dc17206a1baaea906c73e7b735f181db.tar.gz
chromium_src-81cb4bb9dc17206a1baaea906c73e7b735f181db.tar.bz2
Check for an active network connection when network adapter status changes.
BUG=19784 TEST=On a system with two network adapters, ensure one has an active internet connection, and the other does not. Disconnect the active one, and check that in notifier::NetworkStatusDetectorTaskMT::OnNetworkAliveDone() the call to network_alive->alive() returns false. Review URL: http://codereview.chromium.org/377019 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@31623 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/sync/notifier')
-rw-r--r--chrome/browser/sync/notifier/base/win/async_network_alive_win32.cc18
1 files changed, 17 insertions, 1 deletions
diff --git a/chrome/browser/sync/notifier/base/win/async_network_alive_win32.cc b/chrome/browser/sync/notifier/base/win/async_network_alive_win32.cc
index 9497b66..6e02a7f 100644
--- a/chrome/browser/sync/notifier/base/win/async_network_alive_win32.cc
+++ b/chrome/browser/sync/notifier/base/win/async_network_alive_win32.cc
@@ -11,6 +11,7 @@
#include "talk/base/common.h"
#include "talk/base/criticalsection.h"
#include "talk/base/logging.h"
+#include "talk/base/physicalsocketserver.h"
#include "talk/base/scoped_ptr.h"
namespace notifier {
@@ -102,6 +103,7 @@ class PlatformNetworkInfo {
}
}
} while (true);
+
LOG(INFO) << "alive: " << alive;
return alive;
}
@@ -215,7 +217,21 @@ class AsyncNetworkAliveWin32 : public AsyncNetworkAlive {
return;
}
}
- alive_ = network_info_->IsAlive(&error_);
+
+ if (network_info_->IsAlive(&error_)) {
+ // If there is an active connection, check that www.google.com:80
+ // is reachable.
+ talk_base::PhysicalSocketServer physical;
+ scoped_ptr<talk_base::Socket> socket(physical.CreateSocket(SOCK_STREAM));
+ if (socket->Connect(talk_base::SocketAddress("talk.google.com", 5222))) {
+ alive_ = false;
+ } else {
+ alive_ = true;
+ }
+ } else {
+ // If there are no available connections, then we aren't alive.
+ alive_ = false;
+ }
}
virtual void OnWorkStop() {