3.2 Disconnect Role Details

Role of a client and the server when disconnecting the client from the session

Figure 7: Role of a client and the server when disconnecting the client from the session

The role of the client when responding to the instruction to disconnect:

  • The client receives a DN_TERMINATE_SESSION message (section 2.2.2.1) from the server and begins message processing. If an error occurs during message processing, or the received message is invalid, the client performs cleanup and the message is ignored. Otherwise, the client MUST remove itself from the game session.

The role of the server when responding to the instruction to disconnect:

  • The server sends a DN_TERMINATE_SESSION message to the client and removes the client from the game session.

Role of a peer and the host when disconnecting the peer from the session

Figure 8: Role of a peer and the host when disconnecting the peer from the session

The role of a peer when responding to the instruction to disconnect:

  • The peer receives a DN_TERMINATE_SESSION message from the host and begins message processing. If an error occurs during message processing, or the received message is invalid, the peer performs cleanup and the message is ignored. Otherwise, the peer MUST disconnect from the game session.

The role of the host when instructing a peer to disconnect:

  • The host sends a DN_TERMINATE_SESSION message to the disconnecting peer and sends a DN_DESTROY_PLAYER message (section 2.2.2.2) to the other connected peers in the game session. Upon receipt of the DN_DESTROY_PLAYER message from the host, the other connected peers MUST remove the indicated player (the disconnecting peer) from the game session.

Role of the host when performing a peer integrity check

Figure 9: Role of the host when performing a peer integrity check

The role of the host when responding to a request to check the integrity of a peer in the game session:

  1. The host receives an DN_REQ_INTEGRITY_CHECK message (section 2.2.2.6) from a connected peer in the game session and begins message processing. (The peer that is making the request is asking the host to check the integrity of another peer in the game session.) If an error occurs during message processing, or the message is invalid, the host performs cleanup and the message is ignored. Otherwise, the host sends a DN_INTEGRITY_CHECK message (section 2.2.2.7) to the peer that is to be checked.

  2. The host waits for a DN_INTEGRITY_CHECK_RESPONSE message (section 2.2.2.8) from the peer that is being checked. If the peer does not respond in time, the protocol times out and disconnects the peer that was being checked from the game session. The host then sends a DN_DESTROY_PLAYER message to the other connected peers in the game session. Upon receipt of the DN_DESTROY_PLAYER message from the host, the other connected peers MUST remove the indicated player (the disconnecting peer) from the game session.

  3. When a DN_INTEGRITY_CHECK_RESPONSE message is received from the peer that is being checked, the host begins message processing. If an error occurs during message processing, or the message is invalid, the host performs cleanup and the message is ignored. Otherwise, the host sends a DN_TERMINATE_SESSION message to the peer that sent the DN_REQ_INTEGRITY_CHECK message, and sends a DN_DESTROY_PLAYER message to the other connected peers in the game session. Upon receipt of the DN_DESTROY_PLAYER message from the host, the other connected peers MUST remove the indicated player (the terminated peer) from the game session.

Role of a peer during host migration

Figure 10: Role of a peer during host migration

The role of a peer when responding to a request to perform host migration:

  1. The peer receives a DN_HOST_MIGRATE message (section 2.2.2.3) from the host and begins message processing. If an error occurs during message processing, or the message is invalid, the peer performs cleanup and the message is ignored. Otherwise, the peer responds to the host by sending the name table version of the peer via a DN_NAMETABLE_VERSION message (section 2.2.2.4).

  2. The peer waits for an acknowledgment (ACK) from the host. If the host does not respond in time, the protocol times out and terminates the connection.

  3. When the response is received from the host, the peer processes the message.

    1. If the host has responded with a DN_HOST_MIGRATE_COMPLETE message (section 2.2.2.11), the peer processes the message. If an error occurs during message processing, or the message is invalid, the peer performs cleanup and the instruction to migrate is ignored. Otherwise, host migration is complete.

    2. If the host has responded with a DN_REQ_NAMETABLE_OP message (section 2.2.2.9) to the peer, the peer processes the request and sends a DN_ACK_NAMETABLE_OP message (section 2.2.2.10) to the host.

  4. The peer waits for a response from the host. If the host does not respond in time, the protocol times out and terminates the connection.

  5. When the response message is received from the host, the peer processes the messages. The peer MAY receive a DN_RESYNC_VERSION message (section 2.2.2.5) and SHOULD receive a DN_HOST_MIGRATE_COMPLETE message from the host. If an error occurs during message processing, or these messages are invalid, the peer performs cleanup and the messages are ignored. Otherwise, host migration is complete.

Role of the host during host migration

Figure 11: Role of the host during host migration

The role of the host when initiating host migration:

  1. The host sends a DN_HOST_MIGRATE message to all connected peers in the game session and waits to receive a DN_NAMETABLE_VERSION message from each peer. If a peer does not respond in time, the protocol times out and terminates the connection for that peer.

  2. When the DN_NAMETABLE_VERSION response is received from a peer, the host processes the message. If the host receives an invalid name table response message, the host performs cleanup and the message is ignored.

  3. Otherwise, the host examines the peer's name table to determine if it is newer than the host's name table.

    1. If the peer's name table is older than the host's name table, the host sends a DN_HOST_MIGRATE_COMPLETE message to that peer.

    2. If the peer's name table is newer than the host's name table, the host sends a DN_REQ_NAMETABLE_OP message to that peer and waits for a response. If the peer does not respond in time, the connection to that peer is dropped from the game session.

  4. When the DN_ACK_NAMETABLE_OP message is received from the peer, the host processes the message and uses the peer's name table to update it's own name table. The host then MAY send a DN_RESYNC_VERSION message containing the new name table version to all connected peers in the game session. Finally, the host sends a DN_HOST_MIGRATE_COMPLETE message to all connected peers in the game session.