gluon-neighbour-info: end before timeout (#2185)

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
This commit is contained in:
J. Burfeind 2021-03-15 17:52:34 +01:00 committed by GitHub
parent 2ecbe488bc
commit 2c0f8292c6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -44,7 +44,8 @@ void usage() {
puts(" -t <sec> timeout in seconds (default: 3)"); puts(" -t <sec> timeout in seconds (default: 3)");
puts(" -s <event> output as server-sent events of type <event>"); puts(" -s <event> output as server-sent events of type <event>");
puts(" or without type if <event> is the empty string"); puts(" or without type if <event> is the empty string");
puts(" -c <count> only wait for at most <count> replies"); puts(" -c <count> only wait for at most <count> replies (default: 1");
puts(" if -l is not given for unicast destination addresses)");
puts(" -l after timeout (or <count> replies if -c is given),"); puts(" -l after timeout (or <count> replies if -c is given),");
puts(" send another request and loop forever"); puts(" send another request and loop forever");
puts(" -h this help\n"); 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) { if (sse) {
fputs("Content-Type: text/event-stream\n\n", stdout); fputs("Content-Type: text/event-stream\n\n", stdout);
fflush(stdout); fflush(stdout);