3.1.7.1 Host Migration

The host migration process is initiated when the game session host leaves the game session for any reason, such as failing to reply to 8 DPSP_MSG_PING (section 2.2.42) messages. When this occurs, clients in the game session MUST check whether the host migration flag (Session.MigrateHost) is set in the abstract data model. If the flag is not set, the clients MUST terminate connections to all other computer systems and inform the higher layer (game) that the game session has terminated. When the flag is set, a deterministic algorithm is employed to establish the new game session host.

The algorithm requires clients to locate the system players in the Player List and, of these, to determine which player has the lowest Player.ID value. If the system player with the lowest Player.ID value is found to be local, then the client associated with that player MUST become the new game session host. This player then sends a DPSP_MSG_IAMNAMESERVER (section 2.2.33) message to all other clients.

Note Because player IDs are assigned by the host, a new player has no way to "force" itself to become the new host. In addition, although player IDs are allocated sequentially (and starting from a random value), the random value is XOR'd with a secret value to generate the player ID. As a result, there is no guarantee that the distributed player ID values will be sequential. For more information, see sections 3.2.5.4 and 5.1.

If the system player with the lowest player ID is not local, the client MUST start the Ping Timer to detect any other unreachable players until it either receives a DPSP_MSG_IAMNAMESERVER message, or all other computer systems are determined to be unreachable and the local system player now has the lowest player ID value.

Note The DirectPlay 4 Protocol does not perform validation on the sender of a message. An implementation MAY choose to validate the sender of a message but it is not a requirement for compatibility with DirectPlay. For more information, see section 5.1.

Any client that cannot be seen by the new host SHOULD be ejected from the game session by the host sending the client a DPSP_MSG_IAMNAMESERVER message. However, in the existing implementation, only the game session host can send messages to inform players that they are no longer in the game session, which the game session host would not do if a particular client were not reachable from the game session host. Therefore, this behavior is flawed.

The nature of the host migration process is such that any client can send a DPSP_MSG_IAMNAMESERVER message at any time during the process. The algorithm for determining the new game session host is run on all clients simultaneously and, normally, only the client that is determined to be the new host will send the DPSP_MSG_IAMNAMESERVER message. However, sometimes multiple clients can leave the game session simultaneously and connectivity between clients can become inconsistent. As a result, there are situations where more than one client in a game session can decide that it has become the new host, and, as a result, it can send the DPSP_MSG_IAMNAMESERVER message.

Because a client that could potentially become the new host (in the case where there have been multiple client failures) times out each potential new host in-line and in-order, the total amount of time to resolve a migration can be very long. During this time, the view on the game can become inconsistent among the clients. These inconsistencies can lead to a problem where multiple clients with varying views of the remaining clients in the game session can elect themselves as the new host at the same time. This can cause fragmentation of the game session or possibly multiple game sessions with overlapping inconsistent views of the remaining clients.

Note The host migration mechanism in DirectPlay 4 is insufficient for handling some complex host migration situations. Recovery from the simultaneous failure of multiple clients might or might not succeed in leaving an accurate image of the clients in the game session. This problem is addressed by DirectPlay 8.