Made mbtask port check more relaxed

This commit is contained in:
Michiel Broek 2002-05-19 11:24:01 +00:00
parent 4b3dc846c3
commit 1c7d22ed1a
3 changed files with 20 additions and 7 deletions

View File

@ -4811,7 +4811,9 @@ v0.33.20 10-Feb-2002
Removed some debug logging. Removed some debug logging.
Creates the semafore is_inet when the internet connections is Creates the semafore is_inet when the internet connections is
available, and removes it when it is down. available, and removes it when it is down.
Added test for ISDN/modem lines in use. Added test for ISDN/modem lines in use. If a line status
change lasted 5 seconds or longer, the oubound will be
rescanned.
Lots of code cleanup. Lots of code cleanup.
No setup setting anymore for maximum POTS and ISDN lines, this No setup setting anymore for maximum POTS and ISDN lines, this
is now automatic. is now automatic.

View File

@ -183,11 +183,12 @@ void check_ports(void)
if ((lf = fopen(lckname, "r")) == NULL) { if ((lf = fopen(lckname, "r")) == NULL) {
if (tpl->locked) { if (tpl->locked) {
tpl->locked = 0; tpl->locked = 0;
tasklog('+', "Port %s is now free", tpl->tty); tasklog('+', "Port %s is now free after %d seconds", tpl->tty, tpl->locktime);
/* if (tpl->locktime > 4)
* Good, set master rescan flag /*
*/ * Good, set master rescan flag if longer then 4 seconds locked.
changed = TRUE; */
changed = TRUE;
} }
} else { } else {
fscanf(lf, "%d", &tmppid); fscanf(lf, "%d", &tmppid);
@ -200,8 +201,17 @@ void check_ports(void)
} else { } else {
if (!tpl->locked) { if (!tpl->locked) {
tpl->locked = rempid; tpl->locked = rempid;
tpl->locktime = 0;
tasklog('+', "Port %s locked, pid %d", tpl->tty, rempid); tasklog('+', "Port %s locked, pid %d", tpl->tty, rempid);
changed = TRUE; } else {
/*
* Count locktime
*/
tpl->locktime++;
if (tpl->locktime == 5) {
changed = TRUE;
tasklog('+', "Port %s locked for 5 seconds, forcing scan", tpl->tty);
}
} }
} }
} }

View File

@ -14,6 +14,7 @@ typedef struct _pp_list {
unsigned long mflags; /* Analogue modem flags */ unsigned long mflags; /* Analogue modem flags */
unsigned long dflags; /* ISDN flags */ unsigned long dflags; /* ISDN flags */
int locked; /* If port is locked */ int locked; /* If port is locked */
long locktime; /* Time it is locked */
} pp_list; } pp_list;