- int i;
- struct icmp * icp;
- struct host_entry * p = first_host_in_list;
- unsigned char outpack[MAXPACKETSIZE]; /* Use char so this can be aliased later. */
-
- while (p) {
- if (p->socket != -1) {
- struct timeval now;
-
- gettimeofday(&now, (struct timezone *) NULL);
- timeval_diff(&now, &p->last_ping_received);
-
- if (now.tv_sec > (p->max_delay + p->ping_interval)) {
- if ((p->host_up) || retry_down_cmd) {
- if (verbose) printf("INFO: Host %s stopped responding. Executing DOWN command.\n", p->name);
- p->host_up = false;
- if (!fork()) {
- system(p->down_cmd);
- exit(EXIT_SUCCESS);
- } else {
- wait(NULL);
- }
- }
- }