!1026 fix: payload split to avoid the extra data tranfer

Merge pull request !1026 from liurantao/fix_file_send
This commit is contained in:
openharmony_ci 2024-04-13 09:51:40 +00:00 committed by Gitee
commit 29a2100daa
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F

View File

@ -93,7 +93,8 @@ pub async fn unpack_task_message_lock(
return Err(Error::new(ErrorKind::Other, "Packet size incorrect"));
}
let (protect, payload) = body.split_at(expected_head_size);
let (protect, payload_raw) = body.split_at(expected_head_size);
let (payload, _) = payload_raw.split_at(expected_data_size);
let payload_protect = serializer::unpack_payload_protect(protect.to_vec())?;
let channel_id = payload_protect.channel_id;
@ -191,7 +192,8 @@ pub fn unpack_task_message(
return Err(Error::new(ErrorKind::Other, "Packet size incorrect"));
}
let (protect, payload) = body.split_at(expected_head_size);
let (protect, payload_raw) = body.split_at(expected_head_size);
let (payload, _) = payload_raw.split_at(expected_data_size);
let payload_protect = serializer::unpack_payload_protect(protect.to_vec())?;
let channel_id = payload_protect.channel_id;