aqhome: added Utils_FlushOutMessageQueue
This commit is contained in:
@@ -93,6 +93,29 @@ GWEN_MSG *Utils_WaitForSpecificNodeMessage(GWEN_MSG_ENDPOINT_MGR *emgr, GWEN_MSG
|
||||
|
||||
|
||||
|
||||
int Utils_FlushOutMessageQueue(GWEN_MSG_ENDPOINT_MGR *emgr, GWEN_MSG_ENDPOINT *epTcp, int timeoutInSeconds)
|
||||
{
|
||||
time_t startTime;
|
||||
|
||||
startTime=time(NULL);
|
||||
|
||||
while(GWEN_MsgEndpoint_HaveMessageToSend(epTcp)) {
|
||||
time_t now;
|
||||
|
||||
GWEN_MsgEndpointMgr_RunAllEndpoints(emgr);
|
||||
GWEN_MsgEndpointMgr_IoLoopOnce(emgr);
|
||||
now=time(NULL);
|
||||
if (now-startTime>timeoutInSeconds) {
|
||||
DBG_INFO(NULL, "Timeout");
|
||||
return GWEN_ERROR_TIMEOUT;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int Utils_SendAcceptedMsgGroups(GWEN_MSG_ENDPOINT *epTcp, uint32_t groups)
|
||||
{
|
||||
GWEN_MSG *msgOut;
|
||||
|
||||
@@ -22,6 +22,8 @@ GWEN_MSG *Utils_WaitForSpecificNodeMessage(GWEN_MSG_ENDPOINT_MGR *emgr, GWEN_MSG
|
||||
int nodeAddr,
|
||||
int timeoutInSeconds);
|
||||
|
||||
int Utils_FlushOutMessageQueue(GWEN_MSG_ENDPOINT_MGR *emgr, GWEN_MSG_ENDPOINT *epTcp, int timeoutInSeconds);
|
||||
|
||||
int Utils_SendAcceptedMsgGroups(GWEN_MSG_ENDPOINT *epTcp, uint32_t groups);
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user