summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUros Majstorovic <majstor@majstor.org>2024-05-07 22:18:35 +0200
committerUros Majstorovic <majstor@majstor.org>2024-05-07 22:18:35 +0200
commit9b5e1d985643f209f322254615039c09510f74f7 (patch)
tree15b372bd6115141c10db8a2c10400069ab6b2a8f
parent98763d1f48434dfb8c5f4556ec3573920204b7d9 (diff)
close vlink inbound connections on node remove
-rw-r--r--ecp/server/vlink.c9
1 files changed, 8 insertions, 1 deletions
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);