From 23f1110120d1faa392b1b8c81631097284d94f04 Mon Sep 17 00:00:00 2001 From: Jeremy Lakeman Date: Wed, 19 Sep 2012 09:48:12 +0930 Subject: [PATCH] Add optional ping counter --- commandline.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/commandline.c b/commandline.c index 311e5219..d838ade8 100644 --- a/commandline.c +++ b/commandline.c @@ -813,9 +813,13 @@ int app_server_status(int argc, const char *const *argv, struct command_line_opt int app_mdp_ping(int argc, const char *const *argv, struct command_line_option *o) { if (debug & DEBUG_VERBOSE) DEBUG_argv("command", argc, argv); - const char *sid; + const char *sid, *count; if (cli_arg(argc, argv, o, "SID|broadcast", &sid, str_is_subscriber_id, "broadcast") == -1) return -1; + if (cli_arg(argc, argv, o, "count", &count, NULL, "0") == -1) + return -1; + + int icount=atoi(count); overlay_mdp_frame mdp; @@ -853,7 +857,7 @@ int app_mdp_ping(int argc, const char *const *argv, struct command_line_option * if (broadcast) WHY("WARNING: broadcast ping packets will not be encryped."); - while(1) { + while(icount==0 || tx_count",NULL},CLIFLAG_STANDALONE, + {app_mdp_ping,{"mdp","ping","","[]",NULL},CLIFLAG_STANDALONE, "Attempts to ping specified node via Mesh Datagram Protocol (MDP)."}, {app_config_set,{"config","set","","",NULL},CLIFLAG_STANDALONE, "Set specified configuration variable."},