Made tossing mail more relaxed

This commit is contained in:
Michiel Broek 2003-02-08 15:28:31 +00:00
parent e52324bf3a
commit c20e041625
5 changed files with 122 additions and 108 deletions

View File

@ -46,6 +46,9 @@ v0.37.01 14-Jan-2003.
After forking the daemon, the stdin, stdout and stderr are
reopend to /dev/null.
Zero the daily status counters finally works again.
Added experimental code where tossing mail is not started as
long as there are mailers running, but not longer as 30 mins.
This should make the whole system less nervous.
mbfile:
In the import function several bugfixes for reading files.bbs.

4
TODO
View File

@ -149,10 +149,6 @@ mbtask:
mbnewusr:
N: On NetBSD, supress error message from mbpasswd.
mbtask:
U: When a new user registers and presses enter on the name prompt
and then hangs up (at least with telnet), mbtask aborts.
mbsetup:
N: Add a check for double areatag names.

View File

@ -586,12 +586,12 @@ int checktasks(int onsig)
if (first && task[i].rc) {
first = FALSE;
Syslog('t', "Task Type pid stat rc");
Syslog('t', "---------------- ------- ----- ---- -----");
Syslog('t', "Task Type pid stat");
Syslog('t', "---------------- ------- ----- ----");
for (j = 0; j < MAXTASKS; j++)
if (strlen(task[j].name))
Syslog('t', "%-16s %s %5d %s %5d", task[j].name, callmode(task[j].tasktype),
task[j].pid, task[j].running?"runs":"stop", task[j].rc);
Syslog('t', "%-16s %s %5d %s", task[j].name, callmode(task[j].tasktype),
task[j].pid, task[j].running?"runs":"stop");
}
switch (task[i].rc) {
@ -839,7 +839,7 @@ void scheduler(void)
{
struct passwd *pw;
int running = 0, rc, i, rlen, found;
static int LOADhi = FALSE, oldmin = 70, olddo = 70, oldsec = 70;
static int LOADhi = FALSE, oldmin = 70, olddo = 70, oldsec = 70, tosswait = TOSSWAIT_TIME;
char *cmd = NULL, opts[41], port[21];
static char doing[32], buf[2048];
time_t now;
@ -1010,6 +1010,8 @@ void scheduler(void)
/*
* Each minute we execute this part
*/
if (tosswait)
tosswait--;
olddo = tm->tm_min;
TouchSema((char *)"mbtask.last");
if (file_time(tcfgfn) != tcfg_time) {
@ -1083,9 +1085,27 @@ void scheduler(void)
}
if (s_mailin && (!ptimer) && (!runtasktype(MBFIDO))) {
/*
* Here we should check if no mailers are running. Only start
* processing the inbound if no mailers are running, but on busy
* systems this may hardly be the case. So we wait for 30 minutes
* and if there are still mailers running, mbfido is started
* anyway.
*/
if ((ipmailers + runtasktype(CM_ISDN) + runtasktype(CM_POTS)) == 0) {
Syslog('i', "Mailin, no mailers running, start direct");
tosswait = TOSSWAIT_TIME;
launch(TCFG.cmd_mailin, NULL, (char *)"mailin", MBFIDO);
running = checktasks(0);
s_mailin = FALSE;
} else {
Syslog('i', "Mailin, tosswait=%d", tosswait);
if (tosswait == 0) {
launch(TCFG.cmd_mailin, NULL, (char *)"mailin", MBFIDO);
running = checktasks(0);
s_mailin = FALSE;
}
}
}
if (s_newnews && (!ptimer) && (!runtasktype(MBFIDO))) {

View File

@ -12,6 +12,8 @@
#define SLOWRUN 20
#define TMPNAME "TMP."
#define LCKNAME "LOCKTASK"
#define TOSSWAIT_TIME 30
/*

View File

@ -4,7 +4,7 @@
* Purpose ...............: mbtask - ping functions
*
*****************************************************************************
* Copyright (C) 1997-2002
* Copyright (C) 1997-2003
*
* Michiel Broek FIDO: 2:280/2802
* Beekmansbos 10
@ -101,7 +101,6 @@ int ping_receive(struct in_addr);
#define ICMP4_ECHO_LEN ICMP_BASEHDR_LEN
// short p_sequence = 0;
short p_sequence = 10;
unsigned short id;
struct icmphdr icmpd;
@ -176,7 +175,6 @@ int ping_send(struct in_addr addr)
SOL_IP = pe->p_proto;
#endif
// p_sequence++;
id = (unsigned short)get_rand16(); /* randomize a ping id */
#ifdef __linux__
@ -317,13 +315,11 @@ void check_ping(void)
pingresult[1] = pingresult[2] = internet = FALSE;
break;
case P_PAUSE: // Syslog('p', "PAUSE:");
if (time(NULL) >= pingtime)
case P_PAUSE: if (time(NULL) >= pingtime)
pingstate = P_SENT;
break;
case P_WAIT: // Syslog('p', "WAIT:");
if (time(NULL) >= pingtime) {
case P_WAIT: if (time(NULL) >= pingtime) {
pingstate = P_ERROR;
if (icmp_errs < ICMP_MAX_ERRS)
Syslog('?', "ping: to %s timeout", pingaddress);
@ -338,8 +334,8 @@ void check_ping(void)
* Reply received.
*/
rc = time(NULL) - (pingtime - 20);
if (rc > 2)
Syslog('p', "ping: reply after %d seconds", rc);
if (rc > 10)
Syslog('+', "Ping: slow reply after %d seconds", rc);
pingresult[pingnr] = TRUE;
if (pingresult[1] || pingresult[2]) {
if (!internet) {
@ -362,8 +358,7 @@ void check_ping(void)
}
break;
case P_SENT: // Syslog('p', "SENT:");
pingtime = time(NULL) + 10; // 10 secs timeout for pause.
case P_SENT: pingtime = time(NULL) + 10; // 10 secs timeout for pause.
if (pingnr == 1) {
pingnr = 2;
if (strlen(TCFG.isp_ping2)) {
@ -384,7 +379,6 @@ void check_ping(void)
}
}
pingtime = time(NULL) + 20; // 20 secs timeout for a real ping
// Syslog('p', "nr %d address %s", pingnr, pingaddress);
if (inet_aton(pingaddress, &paddr)) {
rc = ping_send(paddr);
if (rc) {
@ -402,8 +396,7 @@ void check_ping(void)
}
break;
case P_ERROR: // Syslog('p', "ERROR:");
pingresult[pingnr] = FALSE;
case P_ERROR: pingresult[pingnr] = FALSE;
if (pingresult[1] == FALSE && pingresult[2] == FALSE) {
icmp_errs++;
if (internet) {