libgnunetchat

library for GNUnet Messenger
Log | Files | Refs | README | LICENSE

commit 1ceb6904458fe14bda8ae1f210c2b8c59455e137
parent b3f3c5c6a855472fd2b33a0a95502ff283af4af3
Author: Jacki <jacki@thejackimonster.de>
Date:   Sat, 22 Feb 2025 14:41:38 +0100

Implement join trigger for ping utility to adjust scaling benchmark

Signed-off-by: Jacki <jacki@thejackimonster.de>

Diffstat:
Mbenchmark/scaling.sh | 17++++++++++++-----
Mtools/gnunet_messenger_ping.c | 24+++++++++++++++++++++---
2 files changed, 33 insertions(+), 8 deletions(-)

diff --git a/benchmark/scaling.sh b/benchmark/scaling.sh @@ -5,22 +5,29 @@ shift 1 $(dirname $0)/.setup.sh PING=$(dirname $0)/../.build_benchmark/tools/messenger_ping +IDENTITY="gnunet-identity" + pong() { local INDEX=$1 shift 1 local PONGS=$((1 + $COUNT - $INDEX)) - local TIMEOUT=$((1 + $PONGS)) + local DELAY=$(($INDEX * 5)) - sleep $INDEX - $PING -P -c $PONGS -t $TIMEOUT $@ > /dev/null + sleep $DELAY + $PING -P -e "a$INDEX" -c $PONGS $@ > /dev/null } for INDEX in $(seq $COUNT); do + $IDENTITY -C "a$INDEX" +done + +$IDENTITY -C "b" + +for INDEX in $(seq $COUNT); do pong $INDEX $@ & done -sleep 1.25 -$PING -c $COUNT -d 1 -t 1 $@ +$PING -e "b" -c $COUNT -d 1 -J $@ wait diff --git a/tools/gnunet_messenger_ping.c b/tools/gnunet_messenger_ping.c @@ -66,6 +66,7 @@ struct GNUNET_MESSENGER_PingTool uint delay; int public_room; int auto_pong; + int join_trigger; bool permanent; size_t counter; @@ -209,6 +210,9 @@ delay_ping (void *cls) tool->task = NULL; + if (tool->join_trigger) + return; + send_ping(tool, tool->room); } @@ -358,7 +362,7 @@ message_callback (void *cls, { case GNUNET_MESSENGER_KIND_JOIN: { - if (!(tool->auto_pong)) + if ((!(tool->auto_pong)) && (!(tool->join_trigger))) send_ping(tool, room); break; @@ -398,10 +402,18 @@ message_callback (void *cls, break; } } - else + else if (tool->auto_pong) { - if ((tool->auto_pong) && (GNUNET_MESSENGER_KIND_TEXT == message->header.kind)) + if (GNUNET_MESSENGER_KIND_TEXT == message->header.kind) send_pong(tool, room, hash, GNUNET_TIME_absolute_ntoh(message->header.timestamp)); + } + else + { + if ((tool->join_trigger) && (GNUNET_MESSENGER_KIND_JOIN == message->header.kind)) + send_ping(tool, room); + + if (0 == GNUNET_CONTAINER_multihashmap_size (tool->ping_map)) + return; struct GNUNET_CONTAINER_MultiHashMapIterator *iter = GNUNET_CONTAINER_multihashmap_iterator_create(tool->ping_map); @@ -648,6 +660,12 @@ main (int argc, "only send back pong messages after a ping", &(tool.auto_pong) ), + GNUNET_GETOPT_option_flag( + 'J', + "join-trigger", + "only send a ping message after join events", + &(tool.join_trigger) + ), GNUNET_GETOPT_OPTION_END };