Chromium Code Reviews| Index: net/base/network_change_notifier_win.cc |
| diff --git a/net/base/network_change_notifier_win.cc b/net/base/network_change_notifier_win.cc |
| index bc906cb8a61c32e115d9e7e1c665b83882f14680..e4e02c7f1d96312cfd442c1dfb587814ab91f184 100644 |
| --- a/net/base/network_change_notifier_win.cc |
| +++ b/net/base/network_change_notifier_win.cc |
| @@ -8,6 +8,8 @@ |
| #include <winsock2.h> |
| #include "base/logging.h" |
| +#include "base/message_loop.h" |
| +#include "base/task.h" |
| #include "net/base/winsock_init.h" |
| #pragma comment(lib, "iphlpapi.lib") |
| @@ -146,6 +148,16 @@ bool NetworkChangeNotifierWin::IsCurrentlyOffline() const { |
| void NetworkChangeNotifierWin::OnObjectSignaled(HANDLE object) { |
| NotifyObserversOfIPAddressChange(); |
| + // Calling IsOffline() at this very moment is likely to give |
| + // the wrong result, so we delay that until a little bit later. |
| + // |
| + // The one second delay chosen here was determined experimentally |
| + // by adamk on Windows 7. |
| + MessageLoop::current()->PostDelayedTask( |
|
eroman
2011/03/01 05:23:10
I suggest adding a bit to keep track of the outsta
adamk
2011/03/01 19:20:06
Thanks for the tip, replaced with a OneShotTimer.
|
| + FROM_HERE, |
| + NewRunnableFunction(&NotifyObserversOfOnlineStateChange), |
| + 1000); |
| + |
| // Start watching for the next address change. |
| WatchForAddressChange(); |
| } |