forked from cory/tildefriends
Show active RPC requests in the connections tab. Probably TMI, but I want greater introspection into what is going on, and this seemed like a positive step.
This commit is contained in:
19
src/ssb.js.c
19
src/ssb.js.c
@ -545,6 +545,7 @@ static JSValue _tf_ssb_connections(JSContext* context, JSValueConst this_val, in
|
||||
}
|
||||
JS_SetPropertyStr(context, object, "tunnel", JS_NewInt32(context, tunnel_index));
|
||||
}
|
||||
JS_SetPropertyStr(context, object, "requests", tf_ssb_connection_requests_to_object(connection));
|
||||
JS_SetPropertyUint32(context, result, i, object);
|
||||
}
|
||||
}
|
||||
@ -1146,6 +1147,22 @@ static void _tf_ssb_on_connections_changed_callback(tf_ssb_t* ssb, tf_ssb_change
|
||||
{
|
||||
case k_tf_ssb_change_create:
|
||||
break;
|
||||
case k_tf_ssb_change_update:
|
||||
{
|
||||
JSValue object = JS_DupValue(context, tf_ssb_connection_get_object(connection));
|
||||
JSValue args[] = {
|
||||
JS_NewString(context, "update"),
|
||||
object,
|
||||
};
|
||||
response = JS_Call(context, callback, JS_UNDEFINED, 2, args);
|
||||
if (tf_util_report_error(context, response))
|
||||
{
|
||||
tf_ssb_remove_connections_changed_callback(ssb, _tf_ssb_on_connections_changed_callback, user_data);
|
||||
}
|
||||
JS_FreeValue(context, args[0]);
|
||||
JS_FreeValue(context, object);
|
||||
}
|
||||
break;
|
||||
case k_tf_ssb_change_connect:
|
||||
{
|
||||
JSValue object = JS_DupValue(context, tf_ssb_connection_get_object(connection));
|
||||
@ -1304,7 +1321,7 @@ static JSValue _tf_ssb_createTunnel(JSContext* context, JSValueConst this_val, i
|
||||
JS_SetPropertyUint32(context, args, 0, arg);
|
||||
JS_SetPropertyStr(context, message, "args", args);
|
||||
JS_SetPropertyStr(context, message, "type", JS_NewString(context, "duplex"));
|
||||
tf_ssb_connection_rpc_send_json(connection, k_ssb_rpc_flag_stream | k_ssb_rpc_flag_new_request, request_number, message, NULL, NULL, NULL);
|
||||
tf_ssb_connection_rpc_send_json(connection, k_ssb_rpc_flag_stream | k_ssb_rpc_flag_new_request, request_number, "tunnel.connect", message, NULL, NULL, NULL);
|
||||
JS_FreeValue(context, message);
|
||||
|
||||
tf_ssb_connection_tunnel_create(ssb, portal_id, request_number, target_id);
|
||||
|
Reference in New Issue
Block a user