diff --git a/src/client.rs b/src/client.rs index 5ffa9f700..e252d4a47 100644 --- a/src/client.rs +++ b/src/client.rs @@ -816,6 +816,7 @@ impl CoAPClient { async fn send_request(&self, request: &mut CoapRequest) -> IoResult { let request_length = request.message.payload.len(); if request_length <= self.block1_size { + request.message.header.message_id = self.gen_message_id(); return self.send_single_request(request).await; } let payload = std::mem::take(&mut request.message.payload); @@ -869,6 +870,7 @@ impl CoAPClient { loop { match Self::intercept_response(request, &mut block2_state) { Ok(true) => { + request.message.header.message_id = self.gen_message_id(); let resp = self.send_single_request(request).await?; request.response = Some(resp); }