From 43a0ab67a2bddd0a9fd223a36a97eaa853fa11b2 Mon Sep 17 00:00:00 2001 From: small_5 <61473216+small-5@users.noreply.github.com> Date: Wed, 18 May 2022 03:20:25 +0800 Subject: [PATCH] Fixed coredump --- src/edge_utils.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/edge_utils.c b/src/edge_utils.c index 519e621..a86f532 100644 --- a/src/edge_utils.c +++ b/src/edge_utils.c @@ -1061,13 +1061,14 @@ static ssize_t sendto_fd (n2n_edge_t *eee, const void *buf, traceEvent(level, "WSAGetLastError(): %u", WSAGetLastError()); #endif } + } else { + /* we reach here, either because !check_sock_ready() or (errno) */ + supernode_disconnect(eee); + eee->sn_wait = 1; + traceEvent(TRACE_DEBUG, "disconnected supernode due to error while sendto_fd"); + return -1; } - - /* we reach here, either because !check_sock_ready() or (errno) */ - supernode_disconnect(eee); - eee->sn_wait = 1; - traceEvent(TRACE_DEBUG, "disconnected supernode due to error while sendto_fd"); - return -1; + return sent; }