Skip to content

Commit 5dec71b

Browse files
committed
fix: don't send the whole buffer on outgoing req
1 parent 6b13624 commit 5dec71b

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

shared/src/conn/outgoing.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,10 @@ impl Pool {
5151

5252
let mut buf = self.store.pop_buf_or_create();
5353

54-
serialize(msg, &mut buf)?;
55-
let resp_header = self.comm_stream(node_uid, &mut buf, true).await?;
54+
let msg_len = serialize(msg, &mut buf)?;
55+
let resp_header = self
56+
.comm_stream(node_uid, &mut buf[0..msg_len], true)
57+
.await?;
5658
let resp_msg = deserialize_body(&resp_header, &buf[Header::LEN..])?;
5759

5860
self.store.push_buf(buf);
@@ -68,8 +70,9 @@ impl Pool {
6870

6971
let mut buf = self.store.pop_buf_or_create();
7072

71-
serialize(msg, &mut buf)?;
72-
self.comm_stream(node_uid, &mut buf, false).await?;
73+
let msg_len = serialize(msg, &mut buf)?;
74+
self.comm_stream(node_uid, &mut buf[0..msg_len], false)
75+
.await?;
7376

7477
self.store.push_buf(buf);
7578

0 commit comments

Comments
 (0)