3.1.7.4.2 STATE_CHOOSE_SERVER

 If F_DISCOVERED is false:

If (SERVERS-NEEDED > 0), choose another server (not chosen previously by this FileSearchRequest) from the Table of Servers element by using the following criteria.

  1. If (AUTH_NEEDED > 0), set NEW_PEER to a random server (not chosen yet by this FileSearchRequest) with authenticated == true. If found, decrement AUTH_NEEDED and return the server; otherwise, set AUTH_NEEDED to zero and go to step 2.

  2. Choose a random server (not chosen yet by this FileSearchRequest) with authenticated == false. If found, return the server.

If one was found, set NEW-SERVER to the server, decrement SERVERS-NEEDED, and set the state to STATE_SEND_REQUEST; otherwise, set the state to STATE_DISCOVER_SERVERS.

 If F_DISCOVERED is true:

(SERVERS-NEEDED will be > 0.)

Set NEW_SERVER to a FileSearchRequest element (not chosen yet by this search) from the table. Decrement SERVERS-NEEDED, and set state to STATE_SEND_REQUEST.