This MR alters the behavior of signald slightly, but significantly: it no longer receives messages from the Signal server when started. Rather, a client must explicitly subscribe to notifications for each account it wants to listen to. This prevents the problem where signald starts, connects to the Signal server, and starts receiving messages before the client is connected to the signald socket (a very common situation).
Note that I had to catch all IOExceptions
thrown by the method that blocks and waits for inbound messages. This may cause other unexpected problems, so further testing with network problems artificially induced will be required before merging this.
TODO:
-
Document the subscribe
andunsubscribe
messages. -
Test what happens when other IOExceptions occur. -
Ensure all known client authors are aware of this change and have updated their code accordingly. -
Ensure new accounts are not automatically subscribed.