Added handling of timeout cmd arg for valgrind test. fixed memory leaks.
This commit is contained in:
@@ -190,10 +190,14 @@ int _doWatch(GWEN_DB_NODE *dbArgs)
|
||||
|
||||
void _awaitAndPrintChanges(GWEN_MSG_ENDPOINT *epTcp, int timeoutInSeconds, const char *tmpl)
|
||||
{
|
||||
time_t tStart;
|
||||
|
||||
tStart=time(NULL);
|
||||
|
||||
for (;;) {
|
||||
GWEN_MSG *msg;
|
||||
|
||||
msg=Utils_WaitForSpecificIpcMessage(epTcp, AQH_MSGTYPE_IPC_DATA_DATACHANGED, timeoutInSeconds);
|
||||
msg=Utils_WaitForSpecificIpcMessage(epTcp, AQH_MSGTYPE_IPC_DATA_DATACHANGED, 2);
|
||||
if (msg) {
|
||||
uint16_t code;
|
||||
|
||||
@@ -207,6 +211,15 @@ void _awaitAndPrintChanges(GWEN_MSG_ENDPOINT *epTcp, int timeoutInSeconds, const
|
||||
GWEN_Msg_free(msg);
|
||||
}
|
||||
}
|
||||
if (timeoutInSeconds) {
|
||||
time_t now;
|
||||
|
||||
now=time(NULL);
|
||||
if ((int)(difftime(now, tStart))>=timeoutInSeconds) {
|
||||
DBG_INFO(NULL, "Timeout");
|
||||
break;
|
||||
}
|
||||
}
|
||||
} /* for */
|
||||
}
|
||||
|
||||
|
||||
@@ -163,9 +163,15 @@ int main(int argc, char **argv)
|
||||
rv=1;
|
||||
}
|
||||
|
||||
GWEN_Fini();
|
||||
GWEN_DB_Group_free(dbArgs);
|
||||
|
||||
AQH_Fini();
|
||||
|
||||
GWEN_Gui_SetGui(NULL);
|
||||
GWEN_Gui_free(gui);
|
||||
|
||||
GWEN_Fini();
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user