Using constants for cita frame header length: missing two locations
@@ -559,7 +559,8 @@ impl BroadcastReq {
);
let msg_bytes: Vec<u8> = self.msg.try_into().unwrap();
- let mut buf = BytesMut::with_capacity(4 + 4 + 1 + self.key.len() + msg_bytes.len());
+ let mut buf =
+ BytesMut::with_capacity(CITA_FRAME_HEADER_LEN + self.key.len() + msg_bytes.len());
pubsub_message_to_network_message(&mut buf, Some((self.key, msg_bytes)));
if let Some(ref mut ctrl) = service.service_ctrl {
let _ = ctrl.filter_broadcast(None, 1, buf.to_vec());
@@ -587,7 +588,8 @@ impl SingleTxReq {
);
let msg_bytes: Vec<u8> = self.msg.try_into().unwrap();
- let mut buf = BytesMut::with_capacity(4 + 4 + 1 + self.key.len() + msg_bytes.len());
+ let mut buf =
+ BytesMut::with_capacity(CITA_FRAME_HEADER_LEN + self.key.len() + msg_bytes.len());
pubsub_message_to_network_message(&mut buf, Some((self.key, msg_bytes)));
if let Some(ref mut ctrl) = service.service_ctrl {
// FIXME: handle the error!
