Added dead server handling

This commit is contained in:
Michiel Broek 2005-04-18 11:52:53 +00:00
parent e334227776
commit 2d53d2213d

View File

@ -310,6 +310,7 @@ void check_servers(void)
} }
Syslog('r', "next call in %d %d seconds", CFG.dialdelay, j); Syslog('r', "next call in %d %d seconds", CFG.dialdelay, j);
tnsl->action = now + (time_t)j; tnsl->action = now + (time_t)j;
changed = TRUE;
break; break;
case NCS_CONNECT: /* case NCS_CONNECT: /*
@ -317,7 +318,14 @@ void check_servers(void)
*/ */
Syslog('r', "%s connect", tnsl->server); Syslog('r', "%s connect", tnsl->server);
if (((int)now - (int)tnsl->last) > 70) { if (((int)now - (int)tnsl->last) > 70) {
Syslog('r', "Server %s is dead", tnsl->server); Syslog('+', "IBC: server %s connection is dead", tnsl->server);
tnsl->state = NCS_DEAD;
tnsl->action = now + (time_t)120; // 2 minutes delay before calling again.
tnsl->gotpass = FALSE;
tnsl->gotserver = FALSE;
tnsl->token = 0;
changed = TRUE;
break;
} }
if (((int)now - (int)tnsl->last) > 60) { if (((int)now - (int)tnsl->last) > 60) {
sprintf(csbuf, "PING\r\n"); sprintf(csbuf, "PING\r\n");
@ -329,6 +337,13 @@ void check_servers(void)
case NCS_HANGUP: Syslog('r', "%s hangup", tnsl->server); case NCS_HANGUP: Syslog('r', "%s hangup", tnsl->server);
tnsl->action = now + (time_t)1; tnsl->action = now + (time_t)1;
tnsl->state = NCS_CALL; tnsl->state = NCS_CALL;
changed = TRUE;
break;
case NCS_DEAD: Syslog('r', "%s dead", tnsl->server);
tnsl->action = now + (time_t)1;
tnsl->state = NCS_CALL;
changed = TRUE;
break; break;
} }
} }