From 1a1586d6519d922fe4fe1cd08c0c26748a00dec7 Mon Sep 17 00:00:00 2001 From: Michiel Broek Date: Sat, 2 Feb 2002 15:15:34 +0000 Subject: [PATCH] Added support for the do_inet semafore --- ChangeLog | 7 +++++++ html/misc/semafore.html | 12 +++++++++--- html/programs/mbtask.html | 7 ++++--- mbmon/mbmon.c | 8 +++++--- mbtask/mbtask.c | 12 ++++++++++++ mbtask/outstat.c | 17 +++++++++++++++-- mbtask/taskstat.c | 9 +++++++-- 7 files changed, 59 insertions(+), 13 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5d06aa1a..b7996dd1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4457,6 +4457,12 @@ v0.33.19 26-Oct-2001 outbound status, nodelist flags etc. Experimental. Added code to do outbound calling, experimental. Calling systems in parallel is now possible. + Creates the semafore do_inet if there is an internet node to + call even if there's no internet connection. Removes this + semafore if there are no internet nodes to call. This can be + used by ppp scripts to see if there is work and when there is + no more work to do. Not important for permament connected + systems. mbmon: Changed the lastcaller screen to display the External Door @@ -4464,6 +4470,7 @@ v0.33.19 26-Oct-2001 When lastcaller info is scrolling, the lines are first proper erased. Fixes for Sparc systems. + Added support for display do_inet semafore in menu 2. mbmsg: Corrected header in logfile for pack function. diff --git a/html/misc/semafore.html b/html/misc/semafore.html index b4145f44..68bad5c8 100644 --- a/html/misc/semafore.html +++ b/html/misc/semafore.html @@ -1,4 +1,5 @@ + @@ -11,7 +12,7 @@
-
Last update 27-jul-2001
+
Last update 02-Feb-2002

 

Semafore files with MBSE BBS.

@@ -19,7 +20,7 @@ The directory $MBSE_ROOT/sema is the hardcoded semafore directory where all semafore's must be created, tested and removed. When the system is booting, the init script will erase all semafore's just before the BBS is started. -This description is valid from MBSE BBS v0.33.18 and newer. +This description is valid from MBSE BBS v0.33.19 and newer.
 zmh		Purpose: to mark the state of Zone Mail Hour. 
@@ -52,11 +53,16 @@ scanout		Purpose: Signal that the outbound must be rescanned.
 		Checked by mbtask to check the outbound.
 		Removed by mbtask as soon as it is detected.
 
+do_inet		Purpose: Signal that there are node(s) to be called via the
+		internet. Usefull for dialup systems to check whether a
+		connection to the internet is needed.
+		Created and removed by mbtask.
+
 mbtask.last	Purpose: A timestamp created and touched by "mbtask" every
 		minute so you can check it is running.
 
-Back Go Back +BackGo Back
diff --git a/html/programs/mbtask.html b/html/programs/mbtask.html index c80e3b63..07ee5a4a 100644 --- a/html/programs/mbtask.html +++ b/html/programs/mbtask.html @@ -1,4 +1,5 @@ + @@ -11,7 +12,7 @@
-
Last update 29-Dec-2001
+
Last update 02-Feb-2002

 

mbtask - MBSE BBS Taskmanager

@@ -259,9 +260,9 @@ Command: GVER:0; Give server version. Reply: 100:1,Version ....; Version reply. Command: GSTA:0; Get complete mbsed status record. (13 fields) -Reply: 100:19,start,laststart,daily,startups,clients,tot_clients,tot_peak,syntax_errs, +Reply: 100:20,start,laststart,daily,startups,clients,tot_clients,tot_peak,syntax_errs, com_errs,today_clients,today_peak,today_syntax,today_comerr,bbsopen, - is_zmh,processing,system_load,sequence; + is_zmh,do_inet,processing,system_load,sequence; Command: GMON:1,n; Get registration info line, 1=First, 0=Next line. Reply: 100:7,pid,tty,user,program,city,isdoing,starttime; diff --git a/mbmon/mbmon.c b/mbmon/mbmon.c index d7e1cdf3..ac3b32ea 100644 --- a/mbmon/mbmon.c +++ b/mbmon/mbmon.c @@ -240,9 +240,10 @@ void system_stat(void) mvprintw( 9, 6, "Total server starts"); mvprintw( 9,62, "Internet"); mvprintw(10, 6, "Connected clients"); - mvprintw(10,62, "Running"); - mvprintw(11,62, "Load avg"); + mvprintw(10,62, "Need inet"); + mvprintw(11,62, "Running"); mvprintw(12,30, "Total Today"); + mvprintw(12,62, "Load avg"); hor_lin(13,30,8); hor_lin(13,45,8); mvprintw(14, 6, "Client connects"); @@ -280,7 +281,8 @@ void system_stat(void) mvprintw(8,72, "%s", atoi(strtok(NULL, ",")) == 1?"Yes":"No "); mvprintw(9,72, "%s", atoi(strtok(NULL, ",")) == 1?"Yes":"No "); mvprintw(10,72,"%s", atoi(strtok(NULL, ",")) == 1?"Yes":"No "); - mvprintw(11,72, "%s ", strtok(NULL, ",")); + mvprintw(11,72,"%s", atoi(strtok(NULL, ",")) == 1?"Yes":"No "); + mvprintw(12,72, "%s ", strtok(NULL, ",")); mvprintw(19,30, (char *)"%s", strtok(NULL, ";")); } diff --git a/mbtask/mbtask.c b/mbtask/mbtask.c index 0c810a99..89b36c8c 100644 --- a/mbtask/mbtask.c +++ b/mbtask/mbtask.c @@ -100,6 +100,7 @@ extern int s_index; /* Compile nl semafore */ extern int s_newnews; /* New news semafore */ extern int s_reqindex; /* Create req index sem */ extern int s_msglink; /* Messages link sem */ +extern int s_do_inet; /* Internet wanted */ int pingstate = P_INIT; /* Ping state */ int pingnr = 1; /* Ping #, 1 or 2 */ int pingresult[2]; /* Ping results */ @@ -533,6 +534,17 @@ int check_calllist(void) sem_set((char *)"scanout", FALSE); } + /* + * Check if we need to remove the do_inet semafore + */ + if (!inet_calls && s_do_inet) { + tasklog('c', "Removing do_inet semafore"); + s_do_inet = FALSE; + if (IsSema((char *)"do_inet")) { + RemoveSema((char *)"do_inet"); + } + } + call_work = 0; for (i = 0; i < MAXTASKS; i++) { if (calllist[i].addr.zone) { diff --git a/mbtask/outstat.c b/mbtask/outstat.c index 9049af65..19b7502d 100644 --- a/mbtask/outstat.c +++ b/mbtask/outstat.c @@ -50,6 +50,7 @@ int isdn_calls; /* ISDN calls to make */ int pots_calls; /* POTS calls to make */ pp_list *pl = NULL; /* Portlist */ _alist_l *alist = NULL; /* Nodes to call list */ +extern int s_do_inet; /* Internet wanted */ @@ -242,10 +243,22 @@ int outstat() * If the node has internet and we have internet available, check if we can send * immediatly. */ - if (internet && TCFG.max_tcp && + if (TCFG.max_tcp && (((tmp->flavors) & F_IMM) || ((tmp->flavors) & F_CRASH) || ((tmp->flavors) & F_NORMAL)) && ((tmp->ipflags & IP_IBN) || (tmp->ipflags & IP_IFC) || (tmp->ipflags & IP_ITN))) { - tmp->flavors |= F_CALL; + /* + * If connection available, set callflag + */ + if (internet) + tmp->flavors |= F_CALL; + /* + * Always set semafore do_inet + */ + if (!s_do_inet) { + CreateSema((char *)"do_inet"); + s_do_inet = TRUE; + tasklog('c', "Created semafore do_inet"); + } } if ((tmp->flavors) & F_IMM ) { flstr[0]='I'; diff --git a/mbtask/taskstat.c b/mbtask/taskstat.c index 912925eb..686a37b2 100644 --- a/mbtask/taskstat.c +++ b/mbtask/taskstat.c @@ -48,6 +48,7 @@ int s_index = FALSE; int s_msglink = FALSE; int s_newnews = FALSE; int s_bbsopen = FALSE; +int s_do_inet = FALSE; extern int UPSalarm; extern int ptimer; @@ -287,14 +288,14 @@ char *stat_status() static char buf[160]; buf[0] = '\0'; - sprintf(buf, "100:19,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%d,%d,%d,%d,%2.2f,%lu;", + sprintf(buf, "100:20,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%d,%d,%d,%d,%d,%2.2f,%lu;", status.start, status.laststart, status.daily, status.startups, status.clients, status.total.tot_clt, status.total.peak_clt, status.total.s_error, status.total.c_error, status.today.tot_clt, status.today.peak_clt, status.today.s_error, status.today.c_error, - status.open, get_zmh(), internet, Processing, Load, status.sequence); + status.open, get_zmh(), internet, s_do_inet, Processing, Load, status.sequence); return buf; } @@ -351,6 +352,8 @@ int sem_set(char *sem, int value) s_msglink = value; } else if (!strcmp(sem, "reqindex")) { s_reqindex = value; + } else if (!strcmp(sem, "do_inet")) { + s_do_inet = value; } else { return FALSE; } @@ -387,6 +390,8 @@ char *sem_status(char *data) value = s_reqindex; } else if (!strcmp(sem, "upsalarm")) { value = UPSalarm; + } else if (!strcmp(sem, "do_inet")) { + value = s_do_inet; } else { tasklog('s', "sem_status(%s) buf=%s", sem, buf); return buf;