diff options
author | nsylvain@chromium.org <nsylvain@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-10 00:09:44 +0000 |
---|---|---|
committer | nsylvain@chromium.org <nsylvain@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-10 00:09:44 +0000 |
commit | 6537d72fb7c6417e08b86db054ed32c2a2ae0828 (patch) | |
tree | b9de220b25d30360a4fe325658460311629aebd3 /net/base | |
parent | 98813b0ac3e0380e5e12b29253fc0df6ced2ddff (diff) | |
download | chromium_src-6537d72fb7c6417e08b86db054ed32c2a2ae0828.zip chromium_src-6537d72fb7c6417e08b86db054ed32c2a2ae0828.tar.gz chromium_src-6537d72fb7c6417e08b86db054ed32c2a2ae0828.tar.bz2 |
On some slow machines, like the virtual machine of Vista 64
and Windows 7, the ping always take more than 100 ms. And retrying
100 times the same operation is never a good idea. So i'm waiting
1 sec instead of 100ms, and i retry 10 times only.
And there was extranous err checks, I'm not sure why they were
there. Was there a line missing there?
Review URL: http://codereview.chromium.org/40282
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@11309 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/base')
-rw-r--r-- | net/base/tcp_pinger.h | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/net/base/tcp_pinger.h b/net/base/tcp_pinger.h index 980e9365..1a2c28b 100644 --- a/net/base/tcp_pinger.h +++ b/net/base/tcp_pinger.h @@ -38,9 +38,9 @@ class TCPPinger { } int Ping() { - // Default is 100 tries, each with a timeout of 100ms, + // Default is 10 tries, each with a timeout of 1000ms, // for a total max timeout of 10 seconds. - return Ping(base::TimeDelta::FromMilliseconds(100), 100); + return Ping(base::TimeDelta::FromMilliseconds(1000), 10); } int Ping(base::TimeDelta tryTimeout, int nTries) { @@ -55,8 +55,7 @@ class TCPPinger { if (err == net::OK) break; PlatformThread::Sleep(static_cast<int>(tryTimeout.InMilliseconds())); - if (err == net::OK) - break; + // Cancel leftover activity, if any io_thread_.message_loop()->PostTask(FROM_HERE, NewRunnableMethod(worker_, |