Now stable has two connect type.
- Direct (EndpointStream) - listen the transport's stream. like Tcpstream.
- Relay (SessionSend) - use other session's channel address as endpoint.
If listen, need handle two way.
- build stable connection table, add other connect type and keep stable connect the remote peer. (by relay).
- If current connection is lost, use other channel to it. and then rebuild stable connection table.
If lost connection.
- If now is Directly, reconnect. (if not ok, change to Relay way.).
- If now is Relay, if relay session is closed, choose other closest peer in DHT and send Ping to check.
Now stable has two connect type.
If listen, need handle two way.
If lost connection.