Finished connection state machine

This commit is contained in:
Michiel Broek 2005-04-18 12:18:41 +00:00
parent 2d53d2213d
commit 5682f871c1

View File

@ -261,7 +261,9 @@ void check_servers(void)
default: errmsg = (char *)"Unknown error"; break;
}
Syslog('+', "IBC: no IP address for %s: %s", tnsl->server, errmsg);
tnsl->action = now + (time_t)120;
tnsl->state = NCS_FAIL;
changed = TRUE;
break;
}
@ -269,6 +271,8 @@ void check_servers(void)
if (tnsl->socket == -1) {
Syslog('+', "$IBC: can't create socket for %s", tnsl->server);
tnsl->state = NCS_FAIL;
tnsl->action = now + (time_t)120;
changed = TRUE;
break;
}
@ -345,6 +349,12 @@ void check_servers(void)
tnsl->state = NCS_CALL;
changed = TRUE;
break;
case NCS_FAIL: Syslog('r', "%s fail", tnsl->server);
tnsl->action = now + (time_t)1;
tnsl->state = NCS_INIT;
changed = TRUE;
break;
}
}
}
@ -482,9 +492,8 @@ void command_squit(char *hostname, char *parameters)
name = strtok(parameters, " \0");
message = strtok(NULL, "\0");
if ((tnsl->state == NCS_CONNECT) && (strcmp(hostname, name) == 0)) {
if (strcmp(name, tnsl->myname) == 0) {
Syslog('+', "IBC: disconnect server %s: %s", name, message);
}
tnsl->state = NCS_HANGUP;
tnsl->action = time(NULL) + (time_t)120; // 2 minutes delay before calling again.
tnsl->gotpass = FALSE;
@ -492,6 +501,7 @@ void command_squit(char *hostname, char *parameters)
tnsl->token = 0;
changed = TRUE;
}
}