From 3b00b31e87218121b5204fe84dc6244bd3f6001f Mon Sep 17 00:00:00 2001 From: Cory McWilliams Date: Wed, 11 Jan 2023 02:30:07 +0000 Subject: [PATCH] Fix ping units, and don't spam it. git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4115 ed5197a5-7fde-0310-b194-c3ffbd925b24 --- src/ssb.rpc.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/ssb.rpc.c b/src/ssb.rpc.c index fa3d95bb..f4e9f347 100644 --- a/src/ssb.rpc.c +++ b/src/ssb.rpc.c @@ -15,10 +15,10 @@ #define _countof(a) ((int)(sizeof((a)) / sizeof(*(a)))) #endif -static void _tf_ssb_rpc_gossip_ping(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) { char buffer[256]; - snprintf(buffer, sizeof(buffer), "%" PRId64, (int64_t)time(NULL)); + snprintf(buffer, sizeof(buffer), "%" PRId64, (int64_t)time(NULL) * 1000); tf_ssb_connection_rpc_send( connection, flags, @@ -30,6 +30,11 @@ static void _tf_ssb_rpc_gossip_ping(tf_ssb_connection_t* connection, uint8_t fla NULL); } +static void _tf_ssb_rpc_gossip_ping(tf_ssb_connection_t* connection, uint8_t flags, int32_t request_number, JSValue args, const uint8_t* message, size_t size, void* user_data) +{ + tf_ssb_connection_add_request(connection, -request_number, _tf_ssb_rpc_gossip_ping_callback, NULL, NULL, NULL); +} + static void _tf_ssb_rpc_blobs_get(tf_ssb_connection_t* connection, uint8_t flags, int32_t request_number, JSValue args, const uint8_t* message, size_t size, void* user_data) { tf_ssb_t* ssb = tf_ssb_connection_get_ssb(connection);