From 47cf59c2e59ecb4ba518c8dc97841dcb8236f214 Mon Sep 17 00:00:00 2001 From: Thomas de Zeeuw Date: Sat, 6 Nov 2021 15:04:56 +0100 Subject: [PATCH] Deregister connection before dropping it in TCP example --- examples/tcp_server.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/examples/tcp_server.rs b/examples/tcp_server.rs index 4cf569027..6347ab6de 100644 --- a/examples/tcp_server.rs +++ b/examples/tcp_server.rs @@ -82,7 +82,9 @@ fn main() -> io::Result<()> { false }; if done { - connections.remove(&token); + if let Some(mut connection) = connections.remove(&token) { + poll.registry().deregister(&mut connection)?; + } } } }