ssb: Results of staring at unexpected shs disconnections: wire up tunnel.endpoints and blobs.createWants more correctly/thoroughly. And add slightly more context when deliberately disconnected from the remote side.
All checks were successful
Build Tilde Friends / Build-All (push) Successful in 24m11s

This commit is contained in:
Cory McWilliams 2025-02-04 21:32:16 -05:00
parent b4049eaeaa
commit dddec489b9
2 changed files with 9 additions and 2 deletions

View File

@ -1712,7 +1712,11 @@ static void _tf_ssb_connection_rpc_recv(tf_ssb_connection_t* connection, uint8_t
bool close_connection = false;
if (size == 0)
{
tf_ssb_connection_close(connection, "rpc recv zero");
char buffer[256];
const char* request_name = "<unknown>";
_tf_ssb_connection_get_request_callback(connection, -request_number, NULL, NULL, &request_name);
snprintf(buffer, sizeof(buffer), "rpc recv zero (req=%d, name=%s)", request_number, request_name);
tf_ssb_connection_close(connection, buffer);
return;
}
else if (flags & k_ssb_rpc_flag_json)

View File

@ -21,6 +21,8 @@ static void _tf_ssb_rpc_send_peers_exchange(tf_ssb_connection_t* connection);
static void _tf_ssb_rpc_start_delete_blobs(tf_ssb_t* ssb, int delay_ms);
static void _tf_ssb_rpc_start_delete_feeds(tf_ssb_t* ssb, int delay_ms);
static void _tf_ssb_rpc_ebt_replicate_resend_clock(tf_ssb_connection_t* connection, bool skip, void* user_data);
static void _tf_ssb_rpc_connection_blobs_createWants_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);
static void _tf_ssb_rpc_gossip_ping_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)
@ -277,6 +279,7 @@ static void _tf_ssb_rpc_blobs_createWants(
tf_ssb_connection_rpc_send_error_method_not_allowed(connection, flags, -request_number, "blobs.createWants");
return;
}
tf_ssb_connection_add_request(connection, -request_number, "blobs.createWants", _tf_ssb_rpc_connection_blobs_createWants_callback, NULL, NULL, NULL);
tf_ssb_blob_wants_t* blob_wants = tf_ssb_connection_get_blob_wants_state(connection);
tf_ssb_add_blob_want_added_callback(ssb, _tf_ssb_rpc_blob_wants_added_callback, NULL, connection);
blob_wants->request_number = request_number;
@ -457,7 +460,7 @@ static void _tf_ssb_rpc_send_endpoints(tf_ssb_t* ssb)
{
if (tf_ssb_connection_is_endpoint(connections[i]) && tf_ssb_connection_is_connected(connections[i]))
{
int32_t request_number = tf_ssb_connection_get_ebt_request_number(connections[i]);
int32_t request_number = tf_ssb_connection_get_endpoint_request_number(connections[i]);
tf_ssb_connection_rpc_send_json(connections[i], k_ssb_rpc_flag_json | k_ssb_rpc_flag_stream, -request_number, NULL, endpoints, NULL, NULL, NULL);
}
}