diff --git a/libasync/src/smoltcp/tcp_stream.rs b/libasync/src/smoltcp/tcp_stream.rs index 9d2e57c..4fed9ef 100644 --- a/libasync/src/smoltcp/tcp_stream.rs +++ b/libasync/src/smoltcp/tcp_stream.rs @@ -82,10 +82,11 @@ impl TcpStream { /// handshaking. Spawns additional tasks for each connection. pub fn listen(port: u16, rx_bufsize: usize, tx_bufsize: usize, backlog: usize, f: F) where - F: Fn(Self) -> R + Copy + 'static, + F: Fn(Self) -> R + Clone + 'static, R: Future + 'static, { for _ in 0..backlog { + let f = f.clone(); task::spawn(async move { loop { // Wait for new connection