Partial implementation of nodelist Txx flags

This commit is contained in:
Michiel Broek
2001-12-27 17:33:15 +00:00
parent 3970593dfa
commit 2df62a976d
6 changed files with 43 additions and 12 deletions

View File

@@ -102,6 +102,7 @@ int pingresult[2]; /* Ping results */
char pingaddress[41]; /* Ping current address */
int masterinit = FALSE; /* Master init needed */
int ptimer = PAUSETIME; /* Pause timer */
int tflags = FALSE; /* if nodes with Txx */
@@ -433,6 +434,8 @@ void load_taskcfg(void)
TCFG.max_pots = 1;
TCFG.max_isdn = 0;
TCFG.max_tcp = 0;
sprintf(TCFG.isp_ping1, "192.168.1.1");
sprintf(TCFG.isp_ping2, "192.168.1.1");
if ((fp = fopen(tcfgfn, "a+")) == NULL) {
tasklog('?', "$Can't create %s", tcfgfn);
die(2);
@@ -1197,6 +1200,12 @@ void scheduler(void)
tasklog('+', "Main configuration changed, reloading");
load_maincfg();
}
/*
* If there is mail or files in the outbound for nodes with
* the Txx flag, then scan the outbound each half hour.
*/
if (tflags && ((tm->tm_min == 0) || (tm->tm_min == 30)))
sem_set((char *)"scanout", TRUE);
}
if (s_bbsopen && !UPSalarm && !LOADhi) {
@@ -1283,7 +1292,7 @@ void scheduler(void)
oldmin = tm->tm_sec / SLOWRUN;
/*
* If the previous pingstat is still P_SENT, the we now consider it a timeout.
* If the previous pingstat is still P_SENT, then we now consider it a timeout.
*/
if (pingstate == P_SENT) {
pingresult[pingnr] = FALSE;
@@ -1333,11 +1342,13 @@ void scheduler(void)
if (internet) {
tasklog('!', "Internet connection is down");
internet = FALSE;
sem_set((char *)"scanout", TRUE);
}
} else {
if (!internet) {
tasklog('!', "Internet connection is up");
internet = TRUE;
sem_set((char *)"scanout", TRUE);
}
icmp_errs = 0;
}

View File

@@ -1,8 +1,7 @@
/*****************************************************************************
*
* File ..................: nodelist.c
* $Id$
* Purpose ...............: Read nodelists information
* Last modification date : 06-Jul-2001
*
*****************************************************************************
* Copyright (C) 1997-2001
@@ -211,6 +210,8 @@ node *getnlent(faddr *addr)
nodebuf.iflags = 0L;
nodebuf.dflags = 0L;
nodebuf.uflags[0] = NULL;
nodebuf.t1 = '\0';
nodebuf.t2 = '\0';
if (addr == NULL)
goto retdummy;
@@ -400,6 +401,13 @@ node *getnlent(faddr *addr)
for (j = 0; xkey[j].key; j++)
if (strcasecmp(p, xkey[j].key) == 0)
nodebuf.xflags |= xkey[j].flag;
if ((p[0] == 'T') && (strlen(p) == 3)) {
/*
* System open hours flag
*/
nodebuf.t1 = p[1];
nodebuf.t2 = p[2];
}
if (!stdflag) {
if (ixflag < MAXUFLAGS) {
nodebuf.uflags[ixflag++] = p;

View File

@@ -1,11 +1,8 @@
/* $Id$ */
#ifndef _NODELIST_H
#define _NODELIST_H
/*
#include "../config.h"
#pragma pack(1)
*/
#define MAXNAME 35
#define MAXUFLAGS 16
@@ -115,6 +112,8 @@ typedef struct _node {
unsigned long oflags; /* Online flags */
unsigned long xflags; /* Request flags */
char *uflags[MAXUFLAGS]; /* User flags */
int t1; /* First Txx flag */
int t2; /* Second Txx flag */
} node;

View File

@@ -54,6 +54,8 @@ static struct _alist
unsigned long moflags; /* Nodelist modem flags */
unsigned long diflags; /* Nodelist ISDN flags */
unsigned long ipflags; /* Nodelist TCP/IP flags */
int t1; /* First Txx flag */
int t2; /* Second Txx flag */
} *alist = NULL;
@@ -71,7 +73,7 @@ int outstat()
{
int rc, first = TRUE;
struct _alist *tmp, *old;
char flstr[9];
char flstr[13];
char temp[81];
tasklog('+', "Scanning outbound");
@@ -92,10 +94,10 @@ int outstat()
for (tmp = alist; tmp; tmp = tmp->next) {
if (first) {
tasklog('+', "Flavor Size Online Modem ISDN TCP/IP Calls Status Address");
tasklog('+', "Flavor Out Size Online Modem ISDN TCP/IP Calls Status Address");
first = FALSE;
}
strcpy(flstr,"...... ..");
strcpy(flstr,"...... ... ..");
if ((tmp->flavors) & F_IMM ) flstr[0]='I';
if ((tmp->flavors) & F_CRASH ) flstr[1]='C';
if ((tmp->flavors) & F_NORMAL) flstr[2]='N';
@@ -104,8 +106,10 @@ int outstat()
if ((tmp->flavors) & F_POLL ) flstr[5]='P';
if ((tmp->flavors) & F_ISPKT ) flstr[7]='M';
if ((tmp->flavors) & F_ISFLO ) flstr[8]='F';
if (tmp->t1) flstr[11] = tmp->t1;
if (tmp->t2) flstr[12] = tmp->t2;
sprintf(temp, "%s %8lu %08x %08x %08x %08x %5d %6d %s", flstr, (long)tmp->size,
sprintf(temp, "%s %8lu %08x %08x %08x %08x %5d %6d %s", flstr, (long)tmp->size,
(unsigned int)tmp->olflags, (unsigned int)tmp->moflags,
(unsigned int)tmp->diflags, (unsigned int)tmp->ipflags,
tmp->cst.tryno, tmp->cst.trystat, ascfnode(&(tmp->addr), 0x1f));
@@ -153,11 +157,15 @@ int each(faddr *addr, char flavor, int isflo, char *fname)
(*tmp)->moflags = nlent->mflags;
(*tmp)->diflags = nlent->dflags;
(*tmp)->ipflags = nlent->iflags;
(*tmp)->t1 = nlent->t1;
(*tmp)->t2 = nlent->t2;
} else {
(*tmp)->olflags = 0L;
(*tmp)->moflags = 0L;
(*tmp)->diflags = 0L;
(*tmp)->ipflags = 0L;
(*tmp)->t1 = '\0';
(*tmp)->t2 = '\0';
}
(*tmp)->time = time(NULL);
(*tmp)->size = 0L;