From 7edaa0071be211262bfe6f1e7c9cf8a49b02bcd0 Mon Sep 17 00:00:00 2001 From: obdev Date: Sat, 22 Apr 2023 14:37:58 +0000 Subject: [PATCH] [bugfix]missing AF_INET6; log downgrade --- deps/easy/src/io/easy_negotiation.c | 20 ++++++++++---------- deps/easy/src/io/easy_socket.c | 3 ++- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/deps/easy/src/io/easy_negotiation.c b/deps/easy/src/io/easy_negotiation.c index 97e78488be..a0622d2f27 100644 --- a/deps/easy/src/io/easy_negotiation.c +++ b/deps/easy/src/io/easy_negotiation.c @@ -10,9 +10,9 @@ * See the Mulan PubL v2 for more details. */ -#include "io/easy_negotiation.h" -#include "io/easy_log.h" -#include "io/easy_socket.h" +#include "io/easy_negotiation.h" +#include "io/easy_log.h" +#include "io/easy_socket.h" #include #include @@ -218,13 +218,13 @@ int net_send_negotiate_message(uint8_t negotiation_enable, int fd, uint64_t magi return ret; } - while ((send_bytes = send(fd, buf, encode_len, 0)) < 0 && errno == EINTR); - - if (send_bytes != encode_len) { - easy_error_log("send negotiate msg failed. addr: %s,errno:%s", addr_str, strerror(errno)); - return -1; - } else { - easy_info_log("eio:%#llx, thread index:%hhu, send:%d bytes, send negotiation success. addr:%s!", (unsigned long long)ne_msg.msg_body.eio_magic, + while ((send_bytes = send(fd, buf, encode_len, 0)) < 0 && errno == EINTR); + + if (send_bytes != encode_len) { + easy_warn_log("send negotiate msg failed. addr: %s, errno:%s", addr_str, strerror(errno)); + return -1; + } else { + easy_info_log("eio:%#llx, thread index:%hhu, send:%d bytes, send negotiation success. addr:%s!", (unsigned long long)ne_msg.msg_body.eio_magic, ne_msg.msg_body.io_thread_index, encode_len, addr_str); } } diff --git a/deps/easy/src/io/easy_socket.c b/deps/easy/src/io/easy_socket.c index fc4d74be42..5d3ecc5688 100644 --- a/deps/easy/src/io/easy_socket.c +++ b/deps/easy/src/io/easy_socket.c @@ -92,7 +92,8 @@ int easy_socket_listen(int udp, easy_addr_t *address, int *flags, int backlog) if (easy_socket_set_opt(fd, SO_REUSEPORT, 1) == 0) { easy_ignore(easy_socket_set_opt(fd, SO_REUSEPORT, 0)); if (flags) { - if (address->family == AF_INET && (*flags & EASY_FLAGS_NOLISTEN)) { + if ((AF_INET == address->family || AF_INET6 == address->family) && + (*flags & EASY_FLAGS_NOLISTEN)) { udp = 2; *flags = EASY_FLAGS_REUSEPORT; }