From 77df1581782ddedaf56f853928a8067cd655e86a Mon Sep 17 00:00:00 2001 From: Cory McWilliams Date: Thu, 19 Jan 2023 00:02:31 +0000 Subject: [PATCH] Don't create tunnel connections to targets we're already talking to. Policy is only one connection per id. git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4137 ed5197a5-7fde-0310-b194-c3ffbd925b24 --- src/ssb.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/ssb.c b/src/ssb.c index c7a727ba..e6bb3ff8 100644 --- a/src/ssb.c +++ b/src/ssb.c @@ -2311,6 +2311,12 @@ static void _tf_ssb_connection_tunnel_callback( tf_ssb_connection_t* tf_ssb_connection_tunnel_create(tf_ssb_t* ssb, const char* portal_id, int32_t request_number, const char* target_id) { + if (tf_ssb_connection_get(ssb, target_id)) + { + /* Already have a possibly more direct connection to target. */ + return NULL; + } + tf_ssb_connection_t* connection = tf_ssb_connection_get(ssb, portal_id); JSContext* context = ssb->context;