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

Unified Diff: chrome/browser/sync/notifier/base/win/async_network_alive_win32.cc

Issue 377019: Check for an active network connection when network adapter status changes.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 1 month 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/sync/notifier/base/win/async_network_alive_win32.cc
===================================================================
--- chrome/browser/sync/notifier/base/win/async_network_alive_win32.cc (revision 31519)
+++ chrome/browser/sync/notifier/base/win/async_network_alive_win32.cc (working copy)
@@ -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 @@
}
}
} while (true);
+
LOG(INFO) << "alive: " << alive;
return alive;
}
@@ -215,7 +217,21 @@
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() {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698