UNKNOWN is the new default status for contacts. A contact is in the
UNKNOWN state when we're not sure whether they are available or not, and
is in the OFFLINE state when we believe that we're online but attempts
to connect to that contact have failed.
A race would cause a call to AddOnionPorts that was blocked waiting for
a control connection to try to publish the service twice, because the
onion republication wasn't done until after the connection status
change.
This is fixed by refactoring the control connection setup to do all
setup before signalling the state change, including copying the list of
onions to publish. The code is slightly cleaner now as well.
Also, slightly refactor Ricochet to be an interface to get the various
top-level components, and let the implementation define it (such as
backend's RicochetCore RPC type)
This is ugly API for now, but it's a simple and relatively safe
solution. It should be cleaned up later.
Data from the Config object can only be accessed by opening the "root"
for reading (OpenRead) or writing (OpenWrite). Multiple readers may be
open simultaneously, but only one writer, which guarantees atomic
behavior. There are ugly edge-cases for save errors and pointer-style
objects in the config tree, so use good behavior.