facebookarchive / network-connection-class

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

Removed the custom parser and used TrafficStats and fixed race condition with starting/stopping #13

Closed SeyelentEco closed 9 years ago

SeyelentEco commented 9 years ago

We didn’t need to use the custom Qtaguid parser since TrafficStats provided us all the info we needed.

Also while testing I noticed a race condition with starting/stopping. The MSG_STOP handler would cancel the MSG_START but it happened asynchronously. If you called stopSampling() then startSampling() like in the sample app, it would schedule a MSG_STOP then a MSG_START, when MSG_STOP was handled, it would cancel the MSG_START accidentally.

jasta commented 9 years ago

lgtm as-is, feel free to fold in my suggestions at your discretion.

zlern2k commented 9 years ago

Red diffs are ossm.

zlern2k commented 9 years ago

Alex -- give the word when you're ready for one of us to pull the merge trigger, or just go ahead and do it yourself once you've integrated feedback to your desired level.

SeyelentEco commented 9 years ago

Refactored the SamplingHandler to not leak any internal details and fixed a few nits.