diff options
author | Natanael Copa <ncopa@alpinelinux.org> | 2011-09-09 13:32:12 +0200 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2011-09-09 13:32:12 +0200 |
commit | e7828c0ba51dc8819cb00de378828ef549d1f190 (patch) | |
tree | 76e5fbc044e9974d176ecc6056d37bb946370da7 /pingu_host.c | |
parent | e148ba2db8e2b2e38c5e4f8ec672de74f72fcf6d (diff) | |
download | pingu-e7828c0ba51dc8819cb00de378828ef549d1f190.tar.bz2 pingu-e7828c0ba51dc8819cb00de378828ef549d1f190.tar.xz |
pingu_host: cleanup. use constant to indicate host online/offline
This is to make code cleaner and easier to read.
Diffstat (limited to 'pingu_host.c')
-rw-r--r-- | pingu_host.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/pingu_host.c b/pingu_host.c index 360ec6d..3630161 100644 --- a/pingu_host.c +++ b/pingu_host.c @@ -68,9 +68,9 @@ int pingu_host_set_status(struct pingu_host *host, int status) int pingu_host_verify_status(struct ev_loop *loop, struct pingu_host *host) { if (host->burst.pings_replied >= host->required_replies) { - pingu_host_set_status(host, 1); + pingu_host_set_status(host, PINGU_HOST_STATUS_ONLINE); } else if (host->burst.pings_sent >= host->max_retries) { - pingu_host_set_status(host, 0); + pingu_host_set_status(host, PINGU_HOST_STATUS_OFFLINE); } else pingu_ping_send(loop, host, 1); return 0; @@ -90,7 +90,7 @@ struct pingu_host *pingu_host_new(char *hoststr, float burst_interval, } host->host = hoststr; - host->status = 1; /* online by default */ + host->status = PINGU_HOST_DEFAULT_STATUS; host->burst_interval = burst_interval; host->max_retries = max_retries; host->required_replies = required_replies; |