- introduced <controller> actions function for listing actions

- introduced <controller> reconnect function
This commit is contained in:
zolliker
2010-04-13 14:17:58 +00:00
parent 38818e650c
commit 6c4f57ec6f
4 changed files with 113 additions and 18 deletions

19
ascon.c
View File

@ -313,7 +313,7 @@ int AsconBaseHandler(Ascon * a)
} else if (ret > 0) {
a->state = AsconConnectDone; /* success */
} else if (ret < 0) {
AsconError(a, "ASC3", errno);
AsconError(a, "ASC3", errno);
}
break;
case AsconWriteStart:
@ -584,6 +584,23 @@ void AsconDisconnect(Ascon * a)
{
if (a->fd > 0) {
close(a->fd);
lastClose = DoubleTime();
}
a->fd = -1;
a->state = AsconNotConnected;
}
void AsconReconnect(Ascon * a, char * hostport)
{
if (a->fd > 0) {
close(a->fd);
lastClose = DoubleTime();
}
if (hostport != NULL && hostport[0] != '\0') {
if (a->hostport) {
free(a->hostport);
}
a->hostport = strdup(hostport);
}
a->fd = -1;
a->state = AsconConnectStart;