- simplified errormsg interface
This commit is contained in:
10
ascon.c
10
ascon.c
@ -75,9 +75,9 @@ void AsconError(Ascon *a, char *msg, int errorno) {
|
||||
state = stateText[a->state];
|
||||
}
|
||||
if (errorno != 0) {
|
||||
a->errList = ErrPutMsg(a->errList, &a->curError, "ASCERR: %s %s (during %s)", msg, strerror(errorno), state);
|
||||
a->errList = ErrPutMsg(a->errList, "ASCERR: %s %s (during %s)", msg, strerror(errorno), state);
|
||||
} else {
|
||||
a->errList = ErrPutMsg(a->errList, &a->curError, "ASCERR: %s (during %s)", msg, state);
|
||||
a->errList = ErrPutMsg(a->errList, "ASCERR: %s (during %s)", msg, state);
|
||||
}
|
||||
a->state |= AsconFailed;
|
||||
}
|
||||
@ -132,7 +132,6 @@ int AsconStdInit(Ascon *a, SConnection *con,
|
||||
a->state = AsconConnectStart;
|
||||
a->reconnectInterval = 10;
|
||||
a->hostport = strdup(argv[1]);
|
||||
a->hostport = strdup(argv[1]);
|
||||
if(argc < 2){
|
||||
a->sendTerminator = strdup(argv[2]);
|
||||
} else {
|
||||
@ -273,7 +272,6 @@ int AsconStdHandler(Ascon *a) {
|
||||
}
|
||||
lastCall = now;
|
||||
switch (a->state) {
|
||||
case AsconKillMe: return 0;
|
||||
case AsconConnectStart:
|
||||
AsconConnect(a);
|
||||
break;
|
||||
@ -425,8 +423,6 @@ Ascon *AsconMake(SConnection *con, int argc, char *argv[]) {
|
||||
}
|
||||
|
||||
void AsconKill(Ascon *a) {
|
||||
a->state = AsconKillMe;
|
||||
a->handler(a);
|
||||
if (a->fd > 0) {
|
||||
close(a->fd);
|
||||
}
|
||||
@ -522,5 +518,5 @@ char *AsconRead(Ascon *a) {
|
||||
}
|
||||
|
||||
ErrMsg *AsconGetErrList(Ascon *a) {
|
||||
return a->curError;
|
||||
return a->errList;
|
||||
}
|
||||
|
Reference in New Issue
Block a user