Respond better when somebody disconnects from us with a tunnel. Trying to robustify tunnels. This is largely untested.

git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4407 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
Cory McWilliams 2023-08-17 16:54:33 +00:00
parent 99c905e908
commit 20557e8ce4

View File

@ -281,7 +281,23 @@ typedef struct tunnel_t
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)
{
tunnel_t* tun = user_data;
tf_ssb_connection_rpc_send(tun->connection, flags, tun->request_number, message, size, NULL, NULL, NULL);
if (flags & k_ssb_rpc_flag_end_error)
{
tf_ssb_connection_rpc_send(
connection,
flags,
-request_number,
(const uint8_t*)"false",
strlen("false"),
NULL,
NULL,
NULL);
tf_ssb_connection_close(tun->connection);
}
else
{
tf_ssb_connection_rpc_send(tun->connection, flags, tun->request_number, message, size, NULL, NULL, NULL);
}
}
void _tf_ssb_rpc_tunnel_cleanup(tf_ssb_t* ssb, void* user_data)