diff options
Diffstat (limited to 'src/ping903.h')
-rw-r--r-- | src/ping903.h | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/ping903.h b/src/ping903.h index 57123a1..5d8dd5b 100644 --- a/src/ping903.h +++ b/src/ping903.h @@ -61,7 +61,16 @@ int cf_syslog_facility(int mode, union cf_callback_arg *arg, void *data); char *get_remote_ip(struct MHD_Connection *conn); +enum { + HOST_STAT_INIT, /* Initial state: data are being collected */ + HOST_STAT_VALID, /* The record is valid */ + HOST_STAT_PENDING, /* The record is valid; new data are being + collected */ + HOST_STAT_INVALID /* The record is invalid (host unreachable) */ +}; + struct host_stat { + int status; struct timeval start_tv; struct timeval stop_tv; unsigned long xmit_count; @@ -73,7 +82,7 @@ struct host_stat { }; static inline int host_stat_is_valid(struct host_stat const *hs) { - return hs->start_tv.tv_sec > 0; + return hs->status == HOST_STAT_VALID || hs->status == HOST_STAT_PENDING; } typedef struct hostaddr { |