sysmaster/backport-fix-change-if-port.fd-is-valid-we-should-avoid-deali.patch
licunlong 0c7d548f94 sync patches from upstream
(cherry picked from commit e23ebb83bd7672e4dc8da68a9a8c73fe6e016341)
2023-06-19 10:39:49 +08:00

30 lines
768 B
Diff

From ef57fb8a85d78dfc6e7cbbf2ac6756da93ffd45f Mon Sep 17 00:00:00 2001
From: licunlong <licunlong1@huawei.com>
Date: Wed, 31 May 2023 11:15:32 +0800
Subject: [PATCH 6/9] fix: change if port.fd() is valid, we should avoid
dealing with invalid port.
---
coms/socket/src/mng.rs | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/coms/socket/src/mng.rs b/coms/socket/src/mng.rs
index aace9c7..82fdcbe 100644
--- a/coms/socket/src/mng.rs
+++ b/coms/socket/src/mng.rs
@@ -593,8 +593,9 @@ impl SocketMng {
fn flush_ports(&self) {
for port in self.ports().iter() {
- port.flush_accept();
-
+ if port.fd() < 0 {
+ continue;
+ }
port.flush_fd();
}
}
--
2.30.2