Skip to content
Snippets Groups Projects
Forked from briar / briar
5384 commits behind the upstream repository.
user avatar
akwizgran authored
Hold a wake lock while Tor is connected to the internet

This is a partial fix for #314. As noted on that ticket, if a Tor connection is lost for any reason other than the device sleeping, the plugin won't try to replace the lost connection. I'm leaving the ticket open until that more general issue is solved.

The Tor plugin uses several variables to keep track of its connectivity status. This patch refactors those variables into an inner class to improve readability and ensure they're accessed atomically. However, it's still possible for the plugin's state to become inconsistent with the state of the Tor process. For example, calls to updateConnectionStatus() may run concurrently on the IO executor, so their calls to enableNetwork() may be interleaved. As usual, locking would solve this problem but create the potential for deadlock, so I won't try to solve it in this patch.

See merge request !168
bba99947
History

Briar is a messaging app designed for activists, journalists, and anyone else who needs a safe, easy and robust way to communicate. Unlike traditional messaging tools such as email, Twitter or Telegram, Briar doesn't rely on a central server - messages are synchronized directly between the users' devices. If the Internet's down, Briar can sync via Bluetooth or Wi-Fi, keeping the information flowing in a crisis. If the Internet's up, Briar can sync via the Tor network, protecting users and their relationships from surveillance.