diff options
author | Greg Hudson <ghudson@mit.edu> | 1997-03-21 19:06:32 +0000 |
---|---|---|
committer | Greg Hudson <ghudson@mit.edu> | 1997-03-21 19:06:32 +0000 |
commit | 68b4069f63a441ea20a8611680b26e8a4c50e2c3 (patch) | |
tree | 16db857e4bf5f18be9d598e597fcba875f8158c3 /zhm | |
parent | fb439023e6235d75a7245db7aa372df28b1aa1de (diff) |
Retransmit notices on a 2-2-4-4-8 schedule instead of on a 25-25-25
schedule.
Diffstat (limited to 'zhm')
-rw-r--r-- | zhm/queue.c | 16 | ||||
-rw-r--r-- | zhm/zhm.h | 4 | ||||
-rw-r--r-- | zhm/zhm_client.c | 2 |
3 files changed, 12 insertions, 10 deletions
diff --git a/zhm/queue.c b/zhm/queue.c index 621b43b..d026817 100644 --- a/zhm/queue.c +++ b/zhm/queue.c @@ -37,6 +37,8 @@ typedef struct _qelem Qelem; Qelem hm_queue = { &hm_queue, &hm_queue, NULL }, *is_in_queue(); +int rexmit_times[] = { 2, 2, 4, 4, 8, -1 }; + extern long time(); extern int timeout_type; @@ -67,7 +69,7 @@ int len; if (!is_in_queue(notice)) { elem = (Qelem *)malloc(sizeof(Qelem)); entry = (Queue *)malloc(sizeof(Queue)); - entry->timeout = time((time_t *)0) + NOTICE_TIMEOUT; + entry->timeout = time((time_t *)0) + rexmit_times[0]; entry->retries = 0; entry->z_packet = (char *)malloc(Z_MAXPKTLEN); (void) memcpy(entry->z_packet, packet, Z_MAXPKTLEN); @@ -145,12 +147,12 @@ struct sockaddr_in *sin; Zperr (ret); com_err("queue", ret, "sending raw notice"); } - srch->q_data->timeout = NOTICE_TIMEOUT; + srch->q_data->timeout = time(0) + rexmit_times[0]; srch->q_data->retries = 0; srch = srch->q_forw; } while (srch != &hm_queue); timeout_type = NOTICES; - (void)alarm(NOTICE_TIMEOUT); + (void)alarm(rexmit_times[0]); } } @@ -231,7 +233,8 @@ struct sockaddr_in *sin; syslog (LOG_INFO, "No notices, shouldn't have happened!"); } else do { if (srch->q_data->timeout <= time((time_t *)0)) { - if (++(srch->q_data->retries) > MAXRETRIES) { + srch->q_data->retries++; + if (rexmit_times[srch->q_data->retries] == -1) { new_server((char *)NULL); break; } else { @@ -254,11 +257,12 @@ struct sockaddr_in *sin; Zperr(ret); com_err("queue", ret, "sending raw notice"); } - srch->q_data->timeout = time((time_t *)0) + NOTICE_TIMEOUT; + srch->q_data->timeout = time((time_t *)0) + + rexmit_times[srch->q_data->retries]; srch = srch->q_forw; } } } while (srch != &hm_queue); timeout_type = NOTICES; - (void)alarm(NOTICE_TIMEOUT); + (void)alarm(rexmit_times[0]); } @@ -37,14 +37,12 @@ #define ever (;;) #define SERV_TIMEOUT 20 -#define NOTICE_TIMEOUT 25 #define BOOTING 1 #define NOTICES 2 -#define MAXRETRIES 2 - extern Code_t send_outgoing(); extern void init_queue(), retransmit_queue(); +extern int rexmit_times[]; #ifdef vax #define MACHINE "vax" diff --git a/zhm/zhm_client.c b/zhm/zhm_client.c index ac634c4..ec41466 100644 --- a/zhm/zhm_client.c +++ b/zhm/zhm_client.c @@ -79,7 +79,7 @@ transmission_tower(notice, packet, pak_len) (void)alarm(tleft); else { timeout_type = NOTICES; - (void)alarm(NOTICE_TIMEOUT); + (void)alarm(rexmit_times[0]); } } (void)add_notice_to_queue(notice, packet, &gsin, pak_len); |