126.96.36.199.3 Associating the Message with a MessageId
Any message sent from the client to the server MUST have a valid MessageId placed in the SMB2 header.
For any message other than SMB2 CANCEL Request the client MUST take an available identifier from Connection.SequenceWindow.
If there is no available identifier, or range of consecutive identifiers for a multi-credit request, as specified in section 188.8.131.52.5, the request MUST wait until the necessary identifiers are available before it is sent to the server. The client MAY<86> send any newly-initiated requests which can be satisfied with available identifiers (including the SMB2 CANCEL Request) to the server on this connection. If the necessary identifiers exceed implementation-defined local requirements, the client MAY fail the request with an implementation-specific error.
When the necessary identifiers are available, the client MUST remove them from Connection.SequenceWindow, set MessageId in the SMB2 header of the request to the first of these, create a new Request, generate a new CancelId and assign it to Request.CancelId, set Request.Message to the SMB2 request being sent to the server, and set Request.Timestamp to the current time; and the Request MUST be inserted into Connection.OutstandingRequests. If Connection.Dialect belongs to the SMB 3.x dialect family and the request includes FileId, the request MUST also be inserted into Open.OutstandingRequests. If the client chooses to implement the Request Expiration Timer, the client MUST then set the Request Expiration Timer to signal at the configured time-out interval for this command.
For an SMB2 CANCEL Request, the client SHOULD<87> set the MessageId field to the identifier that was used for the request that is to be canceled. The SMB2 CANCEL Request MUST NOT be inserted into Connection.OutstandingRequests, and the Request Expiration Timer MUST NOT be set.