ssb: Are we inadvertantly closing connections when an inner tunnel request ends?
Some checks failed
Build Tilde Friends / Build-All (push) Has been cancelled

This commit is contained in:
2025-06-25 20:00:44 -04:00
parent 2178300d8d
commit fca859d93d

View File

@ -303,6 +303,7 @@ typedef struct tunnel_t
{
tf_ssb_connection_t* connection;
int32_t request_number;
bool close_on_error;
} tunnel_t;
static void _tf_ssb_rpc_tunnel_callback(tf_ssb_connection_t* connection, uint8_t flags, int32_t request_number, JSValue args, const uint8_t* message, size_t size, void* user_data)
@ -333,7 +334,10 @@ static void _tf_ssb_rpc_tunnel_callback(tf_ssb_connection_t* connection, uint8_t
JS_FreeValue(context, stack_val);
JS_FreeValue(context, message_val);
tf_ssb_connection_close(tun->connection, buffer);
if (tun->close_on_error)
{
tf_ssb_connection_close(tun->connection, buffer);
}
}
else
{
@ -396,6 +400,7 @@ static void _tf_ssb_rpc_tunnel_connect(tf_ssb_connection_t* connection, uint8_t
*data0 = (tunnel_t) {
.connection = target_connection,
.request_number = tunnel_request_number,
.close_on_error = true,
};
tunnel_t* data1 = tf_malloc(sizeof(tunnel_t));
*data1 = (tunnel_t) {