aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2011-09-09 13:37:50 +0200
committerNatanael Copa <ncopa@alpinelinux.org>2011-09-09 13:37:50 +0200
commitf8ea0da3d82ec64ac88a33631ca259a091111a41 (patch)
tree08bfffe564a2299a7c6276e6c633ecc4363f09af
parente7828c0ba51dc8819cb00de378828ef549d1f190 (diff)
downloadpingu-f8ea0da3d82ec64ac88a33631ca259a091111a41.tar.bz2
pingu-f8ea0da3d82ec64ac88a33631ca259a091111a41.tar.xz
pingu_ping: cleanup. Use constant to indicate if we ignore error or not
This makes code cleaner and easier to read.
-rw-r--r--pingu_burst.c2
-rw-r--r--pingu_host.c2
-rw-r--r--pingu_ping.h3
3 files changed, 5 insertions, 2 deletions
diff --git a/pingu_burst.c b/pingu_burst.c
index 0ec89a4..7e49a96 100644
--- a/pingu_burst.c
+++ b/pingu_burst.c
@@ -40,7 +40,7 @@ void ping_burst_start(struct ev_loop *loop, struct pingu_host *host)
for (rp = ai; rp != NULL; rp = rp->ai_next) {
sockaddr_from_addrinfo(&host->burst.saddr, ai);
- r = pingu_ping_send(loop, host, 0);
+ r = pingu_ping_send(loop, host, PINGU_PING_IGNORE_ERROR);
if (r == 0)
break;
}
diff --git a/pingu_host.c b/pingu_host.c
index 3630161..5fa5aaf 100644
--- a/pingu_host.c
+++ b/pingu_host.c
@@ -72,7 +72,7 @@ int pingu_host_verify_status(struct ev_loop *loop, struct pingu_host *host)
} else if (host->burst.pings_sent >= host->max_retries) {
pingu_host_set_status(host, PINGU_HOST_STATUS_OFFLINE);
} else
- pingu_ping_send(loop, host, 1);
+ pingu_ping_send(loop, host, PINGU_PING_SET_STATUS_ON_ERROR);
return 0;
}
diff --git a/pingu_ping.h b/pingu_ping.h
index f188748..01e25a2 100644
--- a/pingu_ping.h
+++ b/pingu_ping.h
@@ -6,6 +6,9 @@
#include "list.h"
#include "pingu_host.h"
+#define PINGU_PING_IGNORE_ERROR 0
+#define PINGU_PING_SET_STATUS_ON_ERROR 1
+
struct pingu_ping {
int seq;
struct pingu_host *host;