3.1.7.24 Establishing a New Connection

The following state machine demonstrates the state transitions to set up and shut down a Link from the initiator side.

State transitions when setting up a connection

Figure 3: State transitions when setting up a connection

To establish a connection to a remote node, the local node MUST take the following steps:

  • The local node MUST start the Authentication Timer, as specified in section 3.1.6.1.

  • The local node MUST open a TCP connection to the desired IP address.

  • After the TCP connection is established, the connection MUST be set to the OUT_CONN_STATE_SOCK_CONNECTED state.

  • The connection's connection utility MUST be initialized to 0.

The local node MUST send (see section 3.1.7.1) an AUTH_INFO message:

  • The Graph ID Data MUST be set to the graph ID being used.

  • The Source Peer ID Data MUST be set to the local Peer ID.

  • The Destination Peer ID Data MUST be set to the Peer ID of the destination node if that Peer ID is known. Otherwise it MUST be empty.

  • The Direct Connection flag MUST be set according to the application request. For more details, see section 3.1.4.7.

  • If no graph security provider is configured for the node, the connection state MUST be set to OUT_CONN_STATE_AUTHENTICATED.

  • If a graph security provider is configured on the node, the Connection state MUST be set to OUT_CONN_SENT_AUTHINFO and any further incoming message MUST be passed to the graph security provider to complete the connection security negotiation.

If any error occurs during connection establishment, the connection MUST be aborted and any further messages received on the connection MUST NOT be processed.