From 84f1380f4830055bfe69ca14b5ade527a5edef6b Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Sun, 19 Jul 2020 16:14:22 +0800 Subject: [PATCH] libasync: assert that callback consumes data in smoltcp recv --- libasync/src/smoltcp/tcp_stream.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/libasync/src/smoltcp/tcp_stream.rs b/libasync/src/smoltcp/tcp_stream.rs index c5bf991..f6846da 100644 --- a/libasync/src/smoltcp/tcp_stream.rs +++ b/libasync/src/smoltcp/tcp_stream.rs @@ -127,6 +127,7 @@ impl TcpStream { socket.recv(|buf| { if buf.len() > 0 { let (amount, result) = (self.f)(buf); + assert!(amount > 0); (amount, Poll::Ready(Ok(result))) } else { (0, Poll::Pending)