1195972f6Sopenharmony_ciFrom 670f888704c7bbb1121e63bc380ca34b83c43464 Mon Sep 17 00:00:00 2001
2195972f6Sopenharmony_ciFrom: jiangheng <jiangheng12@huawei.com>
3195972f6Sopenharmony_ciDate: Thu, 3 Mar 2022 17:06:03 +0800
4195972f6Sopenharmony_ciSubject: [PATCH] support REUSEPOR option fix rpc msg too much
5195972f6Sopenharmony_ci fix recurring events 
6195972f6Sopenharmony_ci
7195972f6Sopenharmony_ci---
8195972f6Sopenharmony_ci src/api/sockets.c      |  4 ++++
9195972f6Sopenharmony_ci src/include/lwipsock.h | 10 ++++++++--
10195972f6Sopenharmony_ci 2 files changed, 12 insertions(+), 2 deletions(-)
11195972f6Sopenharmony_ci
12195972f6Sopenharmony_cidiff --git a/src/api/sockets.c b/src/api/sockets.c
13195972f6Sopenharmony_ciindex b032ce9..4b682f3 100644
14195972f6Sopenharmony_ci--- a/src/api/sockets.c
15195972f6Sopenharmony_ci+++ b/src/api/sockets.c
16195972f6Sopenharmony_ci@@ -3029,6 +3029,10 @@ lwip_sockopt_to_ipopt(int optname)
17195972f6Sopenharmony_ci     return SOF_KEEPALIVE;
18195972f6Sopenharmony_ci   case SO_REUSEADDR:
19195972f6Sopenharmony_ci     return SOF_REUSEADDR;
20195972f6Sopenharmony_ci+#if USE_LIBOS
21195972f6Sopenharmony_ci+  case SO_REUSEPORT:
22195972f6Sopenharmony_ci+    return SO_REUSEPORT;
23195972f6Sopenharmony_ci+#endif
24195972f6Sopenharmony_ci   default:
25195972f6Sopenharmony_ci     LWIP_ASSERT("Unknown socket option", 0);
26195972f6Sopenharmony_ci     return 0;
27195972f6Sopenharmony_cidiff --git a/src/include/lwipsock.h b/src/include/lwipsock.h
28195972f6Sopenharmony_ciindex 069cdcb..e2519ff 100644
29195972f6Sopenharmony_ci--- a/src/include/lwipsock.h
30195972f6Sopenharmony_ci+++ b/src/include/lwipsock.h
31195972f6Sopenharmony_ci@@ -94,7 +94,8 @@ struct lwip_sock {
32195972f6Sopenharmony_ci #if USE_LIBOS
33195972f6Sopenharmony_ci   uint32_t epoll_events; /* registered events */
34195972f6Sopenharmony_ci   uint32_t events; /* available events */
35195972f6Sopenharmony_ci-  int32_t in_event; /* avoid recurring events */
36195972f6Sopenharmony_ci+  volatile bool have_event; /* avoid recurring events */
37195972f6Sopenharmony_ci+  volatile bool have_rpc_send; /* avoid recurring rpc_send */
38195972f6Sopenharmony_ci   epoll_data_t ep_data;
39195972f6Sopenharmony_ci   struct weakup_poll *weakup;
40195972f6Sopenharmony_ci   struct protocol_stack *stack;
41195972f6Sopenharmony_ci@@ -103,8 +104,13 @@ struct lwip_sock {
42195972f6Sopenharmony_ci   struct pbuf *send_lastdata; /* unread data in one pbuf */
43195972f6Sopenharmony_ci   void *send_ring;
44195972f6Sopenharmony_ci   int32_t recv_flags;
45195972f6Sopenharmony_ci-  int32_t nextfd; /* listenfd list */
46195972f6Sopenharmony_ci+  bool wait_close;
47195972f6Sopenharmony_ci+  int32_t attach_fd;
48195972f6Sopenharmony_ci+  struct lwip_sock *shadowed_sock;
49195972f6Sopenharmony_ci+  struct list_node attach_list;
50195972f6Sopenharmony_ci+  struct list_node listen_list;
51195972f6Sopenharmony_ci   struct list_node recv_list;
52195972f6Sopenharmony_ci+  int32_t nextfd; /* listenfd list */
53195972f6Sopenharmony_ci #endif
54195972f6Sopenharmony_ci };
55195972f6Sopenharmony_ci 
56195972f6Sopenharmony_ci-- 
57195972f6Sopenharmony_ci1.8.3.1
58195972f6Sopenharmony_ci
59