From dd38d877f235350900bbc209ee1b0dc10d8d0c38 Mon Sep 17 00:00:00 2001 From: "aiyion.prime" Date: Mon, 8 Mar 2021 13:30:55 +0100 Subject: [PATCH] gluon-neighbour-info: end before timeout End the process after one result in case -l is not given and destination address is unicast. Reduces singleshot execution time from timeout seconds to around 150ms. resolves #2184 --- package/gluon-neighbour-info/src/gluon-neighbour-info.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/package/gluon-neighbour-info/src/gluon-neighbour-info.c b/package/gluon-neighbour-info/src/gluon-neighbour-info.c index 6e255d87..6470508c 100644 --- a/package/gluon-neighbour-info/src/gluon-neighbour-info.c +++ b/package/gluon-neighbour-info/src/gluon-neighbour-info.c @@ -44,7 +44,8 @@ void usage() { puts(" -t timeout in seconds (default: 3)"); puts(" -s output as server-sent events of type "); puts(" or without type if is the empty string"); - puts(" -c only wait for at most replies"); + puts(" -c only wait for at most replies (default: 1"); + puts(" if -l is not given for unicast destination addresses)"); puts(" -l after timeout (or replies if -c is given),"); puts(" send another request and loop forever"); puts(" -h this help\n"); @@ -232,6 +233,10 @@ int main(int argc, char **argv) { } } + if (!loop && !IN6_IS_ADDR_MULTICAST(&client_addr.sin6_addr)) { + max_count=1; + } + if (sse) { fputs("Content-Type: text/event-stream\n\n", stdout); fflush(stdout);