3.2.5.3 MSG_GETBLKS Request Received

On receiving a valid MSG_GETBLKS (section 2.2.4.3) request message from a client, the server MUST perform the following actions in the order specified:

  1. The server MUST first check if the protocol version is supported, based on the version range comparison rules specified in section 3.1.5.1. If the major version is outside the range of the server implementation, the server MUST construct a MSG_NEGO_RESP (section 2.2.5.1) message, fill in the maximum and minimum protocol versions it supports, and send the MSG_NEGO_RESP message back to the client.

  2. If the major version is supported by the server, the server MUST select a compatible protocol version based on the same rules specified in section 3.1.5.1 for the following reply message.

  3. The server MUST check if its Active Client Count (Abstract Data Model, section 3.2.1) is greater than or equal to the maximum number allowed. If the server is already serving more than or equal to the maximum number of clients, the server MUST reply to the client using a MSG_BLK (section 2.2.5.3) message with an empty block.

  4. Otherwise, the server MUST increment the Active Client Count by 1, set the Upload Timer (Timers, section 2.2.5.3), and construct and send the client a MSG_BLK response message containing a block that is selected based on the following rules:

    • If the block ranges in the MSG_GETBLKS request message contain only one block, the server MUST select the requested block.

    • If the block ranges contain more than one block, the server SHOULD select the first (smallest-index) block from the block ranges and the segment that is specified in the request message.

      The server then MUST check whether the selected block exists in the server's Content Cache (Abstract Data Model section 2.2.5.1). If it does, then the server MUST include this block in the MSG_BLK response message it sends. Otherwise, the response MUST contain an empty MSG_BLK response message. The SegmentID field in the response message MUST be set to the segment ID of the request, and the BlockIndex field MUST be set to the index of the block sent in this message. The server MUST also calculate the value of the NextBlockIndex field (section 2.2.5.3).

      The server MUST apply the encryption algorithm chosen by the higher-layer application to the block in MSG_BLK response message. The list of permissible encryption algorithms is given by the CryptoAlgoID value table in section 2.2.3.

  5. Once the MSG_BLK message is sent, the server MUST decrement the Active Client Count by 1. If the resulting value is negative, the server MUST set the counter to zero.