refactored event loop, now for each ping we create both a ping and a timeout event

pull/193/head
David Schweikert 4 years ago
parent 6600b04152
commit bb8d71ef27

@ -3,10 +3,19 @@ fping 5.0 (unreleased)
## New features
- Refactored event loop, now allowing for period (-p) to be smaller than
timeout (-t). The number of sent pings is now only incremented when the
response is received or when the timeout happens, so that the loss statistic
is always correct (especially important when using interval statistics (-Q)
(#193).
- Improved precision of measurements from 10us to 1us (#136, thanks @tycho)
fping 4.4 (2020-07-24)
======================
## Bugfixes and other changes
- Fix wrong ident used for normal (non-unprivileged) pings (#191, thanks @tycho)
- Fix build with --disable-ipv6 (#187, thanks Polynomial-C)
fping 4.3 (2020-07-11)

@ -19,8 +19,7 @@ $cmd1->stderr_is_eq("");
# fping -v
my $cmd2 = Test::Command->new(cmd => "fping -v");
$cmd2->exit_is_num(0);
$cmd2->stdout_like(qr{fping: Version \S+
fping: comments to david\@schweikert\.ch\n});
$cmd2->stdout_like(qr{fping: Version \S+});
$cmd2->stderr_is_eq("");
# fping with unknown option

@ -17,9 +17,7 @@ $cmd->stderr_is_eq("");
{
my $cmd = Test::Command->new(cmd => "fping -v");
$cmd->exit_is_num(0);
$cmd->stdout_like(qr{ping: Version [45]\.\d+(-rc\d+)?
fping: comments to david\@schweikert\.ch
});
$cmd->stdout_like(qr{ping: Version [45]\.\d+(-rc\d+)?});
$cmd->stderr_is_eq("");
}

File diff suppressed because it is too large Load Diff

@ -7,6 +7,15 @@
#include <sys/types.h>
#include <netinet/in.h>
/* this requires variadic macros, part of C99 */
#if (defined(DEBUG) || defined(_DEBUG))
extern int trace_flag;
#define dbg_printf(fmt, ...) do { if (trace_flag) fprintf(stderr, fmt, __VA_ARGS__); } while (0)
#else
#define dbg_printf(fmt, ...)
#endif
/* fping.c */
void crash_and_burn( char *message );
void errno_crash_and_burn( char *message );

@ -39,6 +39,7 @@
#include "seqmap.h"
#include "limits.h"
#include "options.h"
#include "fping.h"
#include <stdio.h>
#include <stdlib.h>
@ -95,6 +96,8 @@ unsigned int seqmap_add(unsigned int host_nr, unsigned int ping_count, struct ti
current_id = seqmap_next_id;
seqmap_next_id = (seqmap_next_id + 1) % SEQMAP_MAXSEQ;
dbg_printf("seqmap_add(host: %d, index: %d) -> %d\n", host_nr, ping_count, current_id);
return current_id;
}
@ -113,5 +116,7 @@ SEQMAP_VALUE* seqmap_fetch(unsigned int id, struct timespec* now)
return NULL;
}
dbg_printf("seqmap_fetch(%d) -> host: %d, index: %d\n", id, value->host_nr, value->ping_count);
return value;
}

Loading…
Cancel
Save