summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: c19bb6c)
raw | patch | inline | side by side (parent: c19bb6c)
author | Hamish Coleman <hamish@zot.org> | |
Fri, 17 Feb 2017 05:02:21 +0000 (13:02 +0800) | ||
committer | Hamish Coleman <hamish@zot.org> | |
Fri, 17 Feb 2017 05:02:21 +0000 (13:02 +0800) |
src/oping.c | patch | blob | history |
diff --git a/src/oping.c b/src/oping.c
index e439dbfc7b3863ffb504664f01500842fe2761b2..b4999c5c11f7e9aff2a585d02c2a6a25390849c2 100644 (file)
--- a/src/oping.c
+++ b/src/oping.c
memcpy (ctx->history_by_value, ctx->history_by_time,
sizeof (ctx->history_by_time));
+ /* Remove impossible values */
+ for (i = 0; i < ctx->history_size; i++)
+ if (ctx->history_by_value[i]<0)
+ ctx->history_by_value[i]=NAN;
+
/* Sort all RTTs. */
qsort (ctx->history_by_value, ctx->history_size, sizeof
(ctx->history_by_value[0]), compare_double);
index = (history_offset + x) % ctx->history_size;
latency = ctx->history_by_time[index];
+ if (latency < 0) {
+ continue;
+ }
+
if (latency >= 0.0)
{
double ratio;