Clean up some error'd RPC requests. Don't send blobs.createWants if we're not replicating.
Some checks failed
Build Tilde Friends / Build-All (push) Failing after 3m59s

This commit is contained in:
Cory McWilliams 2024-08-24 10:39:47 -04:00
parent 8ac3c5ea22
commit f543cc642e

View File

@ -605,6 +605,7 @@ static void _tf_ssb_rpc_connection_blobs_createWants_callback(
if (!JS_IsUndefined(name))
{
/* { name: "Error" } */
tf_ssb_connection_remove_request(connection, -request_number);
JS_FreeValue(context, name);
return;
}
@ -1136,6 +1137,7 @@ static void _tf_ssb_rpc_ebt_replicate(tf_ssb_connection_t* connection, uint8_t f
if (_is_error(context, args))
{
/* TODO: Send createHistoryStream. */
tf_ssb_connection_remove_request(connection, -request_number);
return;
}
@ -1221,6 +1223,8 @@ static void _tf_ssb_rpc_connections_changed_callback(tf_ssb_t* ssb, tf_ssb_chang
{
JSContext* context = tf_ssb_get_context(ssb);
if (change == k_tf_ssb_change_connect)
{
if (tf_ssb_is_replicator(ssb))
{
JSValue message = JS_NewObject(context);
JSValue name = JS_NewArray(context);
@ -1232,11 +1236,12 @@ static void _tf_ssb_rpc_connections_changed_callback(tf_ssb_t* ssb, tf_ssb_chang
tf_ssb_connection_rpc_send_json(connection, k_ssb_rpc_flag_stream | k_ssb_rpc_flag_new_request, tf_ssb_connection_next_request_number(connection), "blobs.createWants",
message, _tf_ssb_rpc_connection_blobs_createWants_callback, NULL, NULL);
JS_FreeValue(context, message);
}
if (tf_ssb_connection_is_client(connection))
{
message = JS_NewObject(context);
name = JS_NewArray(context);
JSValue message = JS_NewObject(context);
JSValue name = JS_NewArray(context);
JS_SetPropertyUint32(context, name, 0, JS_NewString(context, "tunnel"));
JS_SetPropertyUint32(context, name, 1, JS_NewString(context, "isRoom"));
JS_SetPropertyStr(context, message, "name", name);