From ff33374810add98d4fe3b332cd5e9f8f89c6e9a3 Mon Sep 17 00:00:00 2001 From: Nikolay Kim Date: Thu, 18 Feb 2021 17:59:20 +0600 Subject: [PATCH] Handle EINTR in server accept loop --- ntex/CHANGES.md | 2 ++ ntex/Cargo.toml | 2 +- ntex/src/server/accept.rs | 11 +++++++++-- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/ntex/CHANGES.md b/ntex/CHANGES.md index 411a79c8..0d9fe9da 100644 --- a/ntex/CHANGES.md +++ b/ntex/CHANGES.md @@ -2,6 +2,8 @@ ## [0.2.0-b.12] - 2021-02-18 +* Handle EINTR in server accept loop + * Fix double registation for accept back-pressure ## [0.2.0-b.11] - 2021-02-02 diff --git a/ntex/Cargo.toml b/ntex/Cargo.toml index 8be30410..75475c74 100644 --- a/ntex/Cargo.toml +++ b/ntex/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "ntex" -version = "0.2.0-b.11" +version = "0.2.0-b.12" authors = ["ntex contributors "] description = "Framework for composable network services" readme = "README.md" diff --git a/ntex/src/server/accept.rs b/ntex/src/server/accept.rs index 04a94a18..349684cf 100644 --- a/ntex/src/server/accept.rs +++ b/ntex/src/server/accept.rs @@ -237,8 +237,15 @@ impl Accept { let mut events = mio::Events::with_capacity(128); loop { - if let Err(err) = self.poll.poll(&mut events, None) { - panic!("Poll error: {}", err); + if let Err(e) = self.poll.poll(&mut events, None) { + match e.kind() { + std::io::ErrorKind::Interrupted => { + continue; + } + _ => { + panic!("Poll error: {}", e); + } + } } for event in events.iter() {