facebookarchive / network-connection-class

Listen to current network traffic in the app and categorize the quality of the network.
Other
3.18k stars 515 forks source link

Bug: StartSampling updates mLastTimeReading while not make any read #25

Open antonkov opened 8 years ago

antonkov commented 8 years ago

If mHandler will start execute addSample() at least 1ms after updating mLastTimeReading in startSampling() then IF in addSample will not work and we will add sample with incorrectly small time

if (timeInMs == 0 || ...

public void startSampling() { if (mSamplingCounter.getAndIncrement() == 0) { mHandler.startSamplingThread(); mLastTimeReading = SystemClock.elapsedRealtime(); } }