From 91ec68252d7f69adf3803314cf3d2767d961c5a6 Mon Sep 17 00:00:00 2001 From: Cory McWilliams Date: Mon, 6 Sep 2021 21:21:51 +0000 Subject: [PATCH] Cleans up some confusing output from -t ssb. git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@3660 ed5197a5-7fde-0310-b194-c3ffbd925b24 --- core/ssb.js | 1 - src/ssb.c | 9 +++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/core/ssb.js b/core/ssb.js index 9e626446f..34edc6f09 100644 --- a/core/ssb.js +++ b/core/ssb.js @@ -13,7 +13,6 @@ ssb.registerConnectionsChanged(function(change, connection) { var out_message = {}; out_message[id] = blob.byteLength; g_wants_requests[connection.id].send_json(out_message); - //connection.wants_request.send_json(out_message); } } else { debug_print("blobs.get", id); diff --git a/src/ssb.c b/src/ssb.c index 63576a714..c4155a7a0 100644 --- a/src/ssb.c +++ b/src/ssb.c @@ -582,6 +582,9 @@ static void _tf_ssb_connection_verify_identity(tf_ssb_connection_t* connection, char fullid[k_id_base64_len]; tf_ssb_id_bin_to_str(fullid, sizeof(fullid), connection->serverpub); + JSContext* context = connection->ssb->context; + JS_SetPropertyStr(context, connection->object, "id", JS_NewString(context, fullid)); + connection->state = k_tf_ssb_state_verified; for (int i = 0; i < connection->ssb->connections_changed_count; i++) { connection->ssb->connections_changed[i](connection->ssb, k_tf_ssb_change_connect, connection, connection->ssb->connections_changed_user_data[i]); @@ -767,6 +770,12 @@ static void _tf_ssb_connection_verify_client_identity(tf_ssb_connection_t* conne static_assert(sizeof(c) == 80, "server send size"); _tf_ssb_write(connection, c, sizeof(c)); + char fullid[k_id_base64_len]; + tf_ssb_id_bin_to_str(fullid, sizeof(fullid), connection->serverpub); + + JSContext* context = connection->ssb->context; + JS_SetPropertyStr(context, connection->object, "id", JS_NewString(context, fullid)); + connection->state = k_tf_ssb_state_server_verified; for (int i = 0; i < connection->ssb->connections_changed_count; i++) { connection->ssb->connections_changed[i](connection->ssb, k_tf_ssb_change_connect, connection, connection->ssb->connections_changed_user_data[i]);