From 640eed0ec9ee09e76db3443da01ed4ae69fb8da0 Mon Sep 17 00:00:00 2001 From: Michiel Broek Date: Sat, 16 Mar 2002 14:46:01 +0000 Subject: [PATCH] Added mailer counter to mbtask --- ChangeLog | 1 + mbtask/taskregs.c | 14 +++++++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5e39892d..075c6856 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4681,6 +4681,7 @@ v0.33.20 10-Feb-2002 lines are free to use for dialout. For ISDN and POTS calls, mbtask now decides which tty to use, mbcico gets the tty to use as option on the commandline. + Keeps track of the number of mailers running. mbcico: Fixed binkp driver to accept incoming unprotected sessions. diff --git a/mbtask/taskregs.c b/mbtask/taskregs.c index 0ff95a1c..8af6e81a 100644 --- a/mbtask/taskregs.c +++ b/mbtask/taskregs.c @@ -36,6 +36,7 @@ extern reg_info reginfo[MAXCLIENT]; /* Array with clients */ static int entrypos = 0; /* Status pointer */ +static int mailers = 0; /* Registered mailers */ /*********************************************************************** @@ -100,8 +101,10 @@ int reg_newcon(char *data) */ reginfo[retval].silent = 1; - tasklog('-', "Registered client pgm \"%s\", pid %s, slot %d", prg, pid, retval); stat_inc_clients(); + if (strcmp(prg, (char *)"mbcico") == 0) + mailers++; + tasklog('-', "Registered client pgm \"%s\", pid %s, slot %d, mailers %d", prg, pid, retval, mailers); return retval; } @@ -117,7 +120,9 @@ int reg_closecon(char *data) if ((rec = reg_find(pid)) == -1) return -1; - tasklog('-', "Unregistered client pgm \"%s\", pid %s, slot %d", reginfo[rec].prg, pid, rec); + if (strcmp(reginfo[rec].prg, (char *)"mbcico") == 0) + mailers--; + tasklog('-', "Unregistered client pgm \"%s\", pid %s, slot %d, mailers %d", reginfo[rec].prg, pid, rec, mailers); memset(®info[rec], 0, sizeof(reg_info)); stat_dec_clients(); return 0; @@ -138,7 +143,10 @@ void reg_check(void) if (reginfo[i].pid) { if (kill(reginfo[i].pid, 0) == -1) { if (errno == ESRCH) { - tasklog('?', "Stale registration found for pid %d (%s)", reginfo[i].pid, reginfo[i].prg); + if (strcmp(reginfo[i].prg, (char *)"mbcico") == 0) + mailers--; + tasklog('?', "Stale registration found for pid %d (%s), mailers now %d", + reginfo[i].pid, reginfo[i].prg, mailers); memset(®info[i], 0, sizeof(reg_info)); stat_dec_clients(); }