By assigning a random connection ID during the initial hello that's both
unique to every new connection regardless of target and consistent
across both the connection initiator and acceptor, we can do string
comparison to determine which string is greater than the other. In doing
so, we can ensur the same connection is always terminated, thereby
avoiding closing both connections by accident.
In the future, this will make it much easier to refactor into a
library.
The plan is to allow Agent to have subsystems, but only those which are
related to managing peer-to-peer message and not application-specific
stuff. For example, wemight have a MeshRouting subsystem that listens
for messages and conditionally forwards them based on the content of the
message.
Going to be a heck fo a stack trace if it crashes though.....
Agent → .... → PeerServer → Peer → Connection → FramedTransport → {
rekey, StreamHelpers }