highfidelity/hifi — pull request #2981 by wangyix (2014-06-04 19:09:42+00:00)
Title: added MovingPercentile for filtering bad clockskew values for Node

Cause: packets received by the client were being ignored due to unreasonable flight times of negative tens of msecs. This was caused by delayed processing of ping reply packets on the client side for reasons yet unknown, which broke the assumption that a ping takes the same time to get to a node as it takes to return and process, which lead to clock skews that were tens of msecs less than their actual value.

Repro: run gun.js and shoot as fast as possible at some voxels. Framerate will drop and packets with unreasonable flight times will come in.

Fix: node clock skews are now set to be the 80th percentile of the clock skew samples calculated from the 30 most recent pings instead of only using the one from the most recent ping.

Testing: ran gun.js and shot as fast as possbiel at some voxels. Unreasonable flight time packets no longer appeared. Also ran gameoflife.js on top that, and no unreasonable flight time packets appeared.