From: <sv...@ww...> - 2005-01-02 08:46:39
|
Author: mkrose Date: 2005-01-02 00:46:28 -0800 (Sun, 02 Jan 2005) New Revision: 1433 Modified: trunk/CSP/SimNet/PeerInfo.cpp trunk/CSP/SimNet/PeerInfo.h Log: More tweaks to clock skew measurement. Undo part of the last change to increase the ping rate initially; slower pings are actually better. This is because all the high cost operations when the sim first starts interfere with timing measurements. By receiving fewer pings during startup, we have fewer bad measurements and quicker convergence to the true time offset. Also wait for a couple extra pings before increasing the filtering time constant. (This is all just a bandaid for now.) Browse at: https://www.zerobar.net/viewcvs/viewcvs.cgi?view=rev&rev=1433 Modified: trunk/CSP/SimNet/PeerInfo.cpp =================================================================== --- trunk/CSP/SimNet/PeerInfo.cpp 2005-01-01 11:56:14 UTC (rev 1432) +++ trunk/CSP/SimNet/PeerInfo.cpp 2005-01-02 08:46:28 UTC (rev 1433) @@ -308,9 +308,10 @@ correction = m_time_skew_history.add(correction); m_time_skew = m_time_skew * m_time_filter + correction * (1.0 - m_time_filter); m_last_ping_latency = ping_latency; + //std::cout << "PING TIME SKEW: " << correction << ", " << m_time_skew << ", " << m_time_skew_history.count() << ", " << m_time_filter << "\n"; // wait for a few values to arrive before increasing the filter time constant - if (m_time_skew_history.count() >= 7) { + if (m_time_skew_history.count() >= 9) { if (m_time_filter < 0.9999) { m_time_filter += (1.0 - m_time_filter) * 0.1; } Modified: trunk/CSP/SimNet/PeerInfo.h =================================================================== --- trunk/CSP/SimNet/PeerInfo.h 2005-01-01 11:56:14 UTC (rev 1432) +++ trunk/CSP/SimNet/PeerInfo.h 2005-01-02 08:46:28 UTC (rev 1433) @@ -192,7 +192,7 @@ inline bool needsPing() { // ping quickly at first to help establish a stable time offset; and at // least occasionally after that. - const double ping_limit = (m_connect_time < 20.0 ? 0.5 : 10.0); + const double ping_limit = (m_connect_time < 30.0 ? 1.0 : 10.0); const double quiet_limit = (hasPendingConfirmations() ? 0.0 : 0.5); bool ping = (m_quiet_time > quiet_limit || m_ping_time > ping_limit); if (ping) m_ping_time = 0.0; |