From 5ebd99269bb5bd832e099584384e9188da7fcc01 Mon Sep 17 00:00:00 2001 From: Michiel Broek Date: Thu, 6 Jun 2002 20:11:53 +0000 Subject: [PATCH] Some more changes to the ping state machine --- mbtask/ping.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/mbtask/ping.c b/mbtask/ping.c index 806a5324..e0db91d9 100644 --- a/mbtask/ping.c +++ b/mbtask/ping.c @@ -322,7 +322,8 @@ void check_ping(void) case P_WAIT: // tasklog('p', "WAIT:"); if (time(NULL) >= pingtime) { pingstate = P_ERROR; - tasklog('p', "timeout"); + if (icmp_errs < ICMP_MAX_ERRS) + tasklog('?', "ping: to %s timeout", pingaddress); } else { /* * Quickly eat all packets not for us, we only want our @@ -333,7 +334,9 @@ void check_ping(void) /* * Reply received. */ - tasklog('p', "Reply after %d", time(NULL) - (pingtime - 20)); + rc = time(NULL) - (pingtime - 20); + if (rc != 1) + tasklog('p', "ping: reply after %d seconds", rc); pingresult[pingnr] = TRUE; if (pingresult[1] || pingresult[2]) { if (!internet) { @@ -356,7 +359,7 @@ void check_ping(void) } break; - case P_SENT: tasklog('p', "SENT:"); + case P_SENT: // tasklog('p', "SENT:"); pingtime = time(NULL) + 10; // 10 secs timeout for pause. if (pingnr == 1) { pingnr = 2; @@ -378,7 +381,7 @@ void check_ping(void) } } pingtime = time(NULL) + 20; // 20 secs timeout for a real ping - tasklog('p', "nr %d address %s", pingnr, pingaddress); + // tasklog('p', "nr %d address %s", pingnr, pingaddress); if (inet_aton(pingaddress, &paddr)) { rc = ping_send(paddr); if (rc) { @@ -396,7 +399,7 @@ void check_ping(void) } break; - case P_ERROR: tasklog('p', "ERROR:"); + case P_ERROR: // tasklog('p', "ERROR:"); pingresult[pingnr] = FALSE; if (pingresult[1] == FALSE && pingresult[2] == FALSE) { icmp_errs++;