From 026882c2afee37e0b97a3008af30549bdaf47f11 Mon Sep 17 00:00:00 2001 From: Michiel Broek Date: Sun, 17 Mar 2002 12:14:40 +0000 Subject: [PATCH] Added reset command to mbout --- ChangeLog | 4 ++++ mbcico/mbout.c | 26 +++++++++++++++++++------- mbcico/outstat.c | 22 +++++++++++++++++++--- mbcico/outstat.h | 1 + 4 files changed, 43 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index d54a1aa7..54962003 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4695,6 +4695,10 @@ v0.33.20 10-Feb-2002 mbout: The status display has now 9 digits for the outbound size. + New command, mbout reset , unconditionally resets the + nodes "try" counter, ie. make an undiable node try to call + again. + The status command displays the call attempts. mbsebbs: On some systems the download taglists contained garbage after diff --git a/mbcico/mbout.c b/mbcico/mbout.c index 1d83c9a2..81fefbb9 100644 --- a/mbcico/mbout.c +++ b/mbcico/mbout.c @@ -48,6 +48,7 @@ int do_poll = FALSE; /* Poll a node */ int do_req = FALSE; /* Request files from a node */ int do_stat = FALSE; /* Show outbound status */ int do_stop = FALSE; /* Stop polling a node */ +int do_reset = FALSE; /* Reset node's try counter */ int e_pid = 0; /* Pid of child */ extern int show_log; /* Show logging */ time_t t_start; /* Start time */ @@ -129,10 +130,11 @@ void Help() colour(9, 0); printf(" Commands are:\n\n"); colour(3, 0); - printf(" a att Attach a file to a node\n"); - printf(" n node Show nodelist information\n"); - printf(" p poll [node..node] Poll node(s) (always crash)\n"); - printf(" r req [file..file] Request file(s) from node\n"); + printf(" a att Attach a file to a node\n"); + printf(" n node Show nodelist information\n"); + printf(" p poll [node..node] Poll node(s) (always crash)\n"); + printf(" req req [file..file] Request file(s) from node\n"); + printf(" res reset Reset node(s) \"try\" counter\n"); printf(" sta stat Show outbound status\n"); printf(" sto stop [node..node] Stop polling node(s)\n"); printf("\n"); @@ -207,8 +209,10 @@ int main(int argc, char *argv[]) do_node = TRUE; if (!strncasecmp(argv[1], "p", 1)) do_poll = TRUE; - if (!strncasecmp(argv[1], "r", 1)) + if (!strncasecmp(argv[1], "req", 3)) do_req = TRUE; + if (!strncasecmp(argv[1], "res", 3)) + do_reset = TRUE; if (!strncasecmp(argv[1], "sta", 3)) do_stat = TRUE; if (!strncasecmp(argv[1], "sto", 3)) @@ -247,12 +251,12 @@ int main(int argc, char *argv[]) /* * Get node number from commandline */ - if (do_attach || do_node || do_poll || do_stop || do_req) { + if (do_attach || do_node || do_poll || do_stop || do_req || do_reset) { if (argc < 3) Fatal((char *)"Not enough parameters"); } - if (do_attach || do_node || do_req) { + if (do_attach || do_node || do_req || do_reset) { if ((addr = parsefaddr(argv[2])) == NULL) Fatal((char *)"Unrecognizable address"); } @@ -281,6 +285,14 @@ int main(int argc, char *argv[]) die(rc); } + if (do_reset) { + rc = reset(addr); + tidy_faddr(addr); + if (rc) + rc += 100; + die(rc); + } + if (do_attach) { if (argc < 5) Fatal((char *)"Not enough parameters"); diff --git a/mbcico/outstat.c b/mbcico/outstat.c index 973dc32f..73dfb834 100644 --- a/mbcico/outstat.c +++ b/mbcico/outstat.c @@ -71,6 +71,7 @@ int outstat() char flstr[6]; time_t age; char temp[81]; + callstat *cst; if ((rc = scanout(each))) { WriteError("Error scanning outbound, aborting"); @@ -79,11 +80,11 @@ int outstat() if (!do_quiet) { colour(10, 0); - printf("flavor size age address\n"); + printf("flavor try size age address\n"); colour(3, 0); } - Syslog('+', "Flavor Size Age Address"); + Syslog('+', "Flavor Try Size Age Address"); for (tmp = alist; tmp; tmp = tmp->next) { if ((tmp->flavors & F_FREQ) || (tmp->size) || 1) { strcpy(flstr,"......"); @@ -94,9 +95,11 @@ int outstat() if ((tmp->flavors) & F_FREQ ) flstr[4]='R'; if ((tmp->flavors) & F_POLL ) flstr[5]='P'; + cst = getstatus(&(tmp->addr)); age = time(NULL); age -= tmp->time; - sprintf(temp, "%s %9lu %s %s", flstr, (long)tmp->size, str_time(age), ascfnode(&(tmp->addr), 0x1f)); + sprintf(temp, "%s %3d %9lu %s %s", flstr, cst->tryno, (long)tmp->size, + str_time(age), ascfnode(&(tmp->addr), 0x1f)); if (!do_quiet) printf("%s\n", temp); @@ -321,6 +324,19 @@ int poll(faddr *addr, int stop) +int reset(faddr *addr) +{ + if (addr == NULL) + return 0; + + putstatus(addr, 0, 0); + CreateSema((char *)"scanout"); + + return 0; +} + + + int freq(faddr *addr, char *fname) { char *req; diff --git a/mbcico/outstat.h b/mbcico/outstat.h index d6b600cd..1ba8afac 100644 --- a/mbcico/outstat.h +++ b/mbcico/outstat.h @@ -5,6 +5,7 @@ int each(faddr *, char, int, char *); int outstat(void); int poll(faddr *, int); +int reset(faddr *); int freq(faddr *, char *);