dedis / prifi

PriFi, a low-latency, local-area anonymous communication network.

Home Page:https://prifi.net

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

iOS introduces sporadic failed rounds when trying to sleep

aledcuevas opened this issue · comments

Description: It seems like iOS creates socket failures and throttles app performance in a non-deterministic way. This causes semi-random failed rounds to occur from time to time, particularly when the device wants to enter sleep mode (e.g. locked). The behavior is more prevalent when "low battery mode" is enabled. It might also be more prevalent when the app is below 20% battery.

As per the documentation,

"Do minimal work while running in the background. The execution time given to background apps is more constrained than the amount of time given to the foreground app. Apps that spend too much time executing in the background can be throttled back by the system or terminated"

"Be prepared to handle connection failures in your network-based sockets. The system may tear down socket connections while your app is suspended for any number of reasons."

https://developer.apple.com/library/archive/documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/BackgroundExecution/BackgroundExecution.html

Steps to reproduce:

  1. Set up the protocol (start relay, start trustee, start "non-prifi" SOCKS server)
  2. Connect the iOS client (1.9.1) to the relay
  3. Ensure that there are not background apps that will keep the device awake (e.g. video playback) and lock the phone
  4. The protocol will continue to run but will introduce 1-2 failed rounds from time to time.

Observing the events, it seems like the device: tries to enter sleep -> fails a round -> and is woken up again every so often (see attached).