[bugfix]missing AF_INET6; log downgrade

This commit is contained in:
obdev 2023-04-22 14:37:58 +00:00 committed by ob-robot
parent 1d918d8dbf
commit 7edaa0071b
2 changed files with 12 additions and 11 deletions

View File

@ -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 <sys/socket.h>
#include <sys/ioctl.h>
@ -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);
}
}

View File

@ -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;
}