diff options
| author | songyanchao <[email protected]> | 2022-09-18 22:27:04 -0400 |
|---|---|---|
| committer | songyanchao <[email protected]> | 2022-09-18 22:27:04 -0400 |
| commit | ee1caef09ed3e108cb80bc471a0aec4447a7f12f (patch) | |
| tree | 0e929adc0ca49ed0c9d6ff651f72c7aeb071ac93 | |
| parent | 7d8d5398f44ac254d2d260e2d537cf2c36829cf9 (diff) | |
| parent | 34ea49b483e3eae5fa6ba9c6a476fc26a94e590c (diff) | |
Merge branch 'feature-eth-egress-node' of git.mesalab.cn:MESA_Platform/marsio into feature-eth-egress-node
| -rw-r--r-- | infra/src/rpc.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/infra/src/rpc.c b/infra/src/rpc.c index 108b249..2ef6f97 100644 --- a/infra/src/rpc.c +++ b/infra/src/rpc.c @@ -11,7 +11,7 @@ #include <fcntl.h> #include <arpa/inet.h> #include <errno.h> -#include <linux/tcp.h> +#include <netinet/tcp.h> #include <systemd/sd-daemon.h> @@ -258,16 +258,17 @@ void *rpc_client_monitor_conn_health(void *arg) continue ; } } - getsockopt(events.data.fd, IPPROTO_TCP, TCP_INFO, &info, (socklen_t *)&len); - if((info.tcpi_state != 1)){ - pthread_mutex_lock(&handler->mutex); - if(handler->conn){ + pthread_mutex_lock(&handler->mutex); + if(handler->conn){ + getsockopt(handler->conn->fd, IPPROTO_TCP, TCP_INFO, &info, (socklen_t *)&len); + if(info.tcpi_state != TCP_ESTABLISHED){ + epoll_ctl(handler->epfd, EPOLL_CTL_DEL, handler->conn->fd, NULL); rpc_common_close_conn(handler->conn); } - epoll_ctl(handler->epfd, EPOLL_CTL_DEL, events.data.fd, NULL); - pthread_mutex_unlock(&handler->mutex); } + pthread_mutex_unlock(&handler->mutex); } + return NULL; } void rpc_client_set_block_sendtimeout(int sock) { |
