From 9b5e1d985643f209f322254615039c09510f74f7 Mon Sep 17 00:00:00 2001 From: Uros Majstorovic Date: Tue, 7 May 2024 22:18:35 +0200 Subject: close vlink inbound connections on node remove --- ecp/server/vlink.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'ecp') diff --git a/ecp/server/vlink.c b/ecp/server/vlink.c index d0c865b..6efb654 100644 --- a/ecp/server/vlink.c +++ b/ecp/server/vlink.c @@ -145,8 +145,15 @@ void vlink_keyx(ECPSocket *sock, int keyx_period) { ecp_conn_unlock(conn); if (is_d) { + ECPConnection *_conn = NULL; + LOG(LOG_DEBUG, "vlink_keyx: disconnect\n"); - // close all inbound connections; + /* close all inbound connections */ + while ((_conn = ecp_sock_search_gc(conn->sock, &conn->remote.key_perma.public))) { + ecp_conn_close(_conn); + ecp_conn_refcount_dec(_conn); + } + pthread_rwlock_wrlock(&vlink_conn_rwlock); ht_remove_conn(vlink_conn, conn); pthread_rwlock_unlock(&vlink_conn_rwlock); -- cgit v1.2.3