3.1.5.2.2 Receive WELCOME

This message is sent by the connection responder in response to a CONNECT message. If the message fails to conform to any of the following conditions, then the message MUST be discarded unprocessed and the connection MUST be terminated.

  • The Message Size MUST be at least 0x20.

  • Address Count * 20 + Address Offset MUST be less than Message Size.

  • Peer ID Offset MUST be at least Address Count * 20 + Address Offset.

  • Friendly Name Offset MUST be greater than Peer ID Offset.

  • Friendly Name Offset MUST be no greater than Message Size.

If this message is received, but the link is not in the LINK_STATE_CONNECT_WAIT state, then the message MUST be discarded and the connection MUST be terminated.

Otherwise, the remote node information from the WELCOME message MUST be added to the Neighbor List, and the connection moved into the LINK_STATE_CONNECTED state.

If this is the first connection for the node (that is, the Neighbor List has only this one entry), the local node MUST:

  • Perform graph maintenance. For more details, see section 3.1.7.16.

  • If the Defer Expiration flag is set, the Record Expiration Time MUST be set to expire in 0 seconds.

Also, a PING message MUST be sent (see section 3.1.7.1) on each connection in the LINK_STATE_CONNECTED state, to help detect dead TCP connections. The message MUST conform to the syntax specified in section 2.2.4.1. The addresses in the message's IPv6 address array, if any, MUST be added to the Referral List. The oldest entries from the Referral List MUST be removed if the Referral List has reached its maximum size (see section 3.1.1).

The Local node's peer time MUST be updated according to the steps below:

  • The PTWELCOME time MUST be computed as follows:

    where:

    • initially is the Peer Time included in the WELCOME message.

    • TCONNECT is the Peer Time when the CONNECT message was sent.

    • TWelcome is the Peer Time when the WELCOME message is received.

  • If PTWELCOME is more than 20 minutes different from the local peer time, the received peer time MUST be ignored, and MUST NOT be included in the Peer Time averaging below.

  • Otherwise, the local node's Peer Time Delta PTDlocal MUST be calculated as follows:

  • If the neighbor list has only this one entry, the local peer time MUST be set to the adjusted remote node peer time as follows:

  • Otherwise the local node's peer time MUST be adjusted using the remote node's peer time as follows:

Finally, the local node MUST begin synchronizing the local database with the remote node. If the NeverConnected flag is set to true, it MUST begin a Sync All (see section 3.1.7.29). Otherwise, it MUST begin a Time-based Sync (see section 3.1.7.30).