Skip to content

Commit c9b4e4c

Browse files
authored
examples: fix the write length in the connect-tcp example (#7581)
Signed-off-by: Martin Tzvetanov Grigorov <[email protected]>
1 parent 3eb515e commit c9b4e4c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

examples/connect-udp.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ async fn recv(
8585
let n = reader.recv(&mut buf[..]).await?;
8686

8787
if n > 0 {
88-
stdout.send(Bytes::from(buf)).await?;
88+
stdout.send(Bytes::copy_from_slice(&buf[..n])).await?;
8989
}
9090
}
9191
}

0 commit comments

Comments
 (0)