fixed another memory leak: handle received result responses
just remove them from the queue.
This commit is contained in:
@@ -38,6 +38,7 @@
|
|||||||
init.h
|
init.h
|
||||||
fini.h
|
fini.h
|
||||||
loop.h
|
loop.h
|
||||||
|
loop_broker.h
|
||||||
loop_tty.h
|
loop_tty.h
|
||||||
loop_tty_ipc.h
|
loop_tty_ipc.h
|
||||||
loop_tty_broker.h
|
loop_tty_broker.h
|
||||||
@@ -53,6 +54,7 @@
|
|||||||
init.c
|
init.c
|
||||||
fini.c
|
fini.c
|
||||||
loop.c
|
loop.c
|
||||||
|
loop_broker.c
|
||||||
loop_tty.c
|
loop_tty.c
|
||||||
loop_tty_ipc.c
|
loop_tty_ipc.c
|
||||||
loop_tty_broker.c
|
loop_tty_broker.c
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
#include "./loop.h"
|
#include "./loop.h"
|
||||||
#include "./loop_tty.h"
|
#include "./loop_tty.h"
|
||||||
#include "./loop_ipc.h"
|
#include "./loop_ipc.h"
|
||||||
|
#include "./loop_broker.h"
|
||||||
#include "./aqhomed_p.h"
|
#include "./aqhomed_p.h"
|
||||||
#include "./tty_log.h"
|
#include "./tty_log.h"
|
||||||
#include "./db.h"
|
#include "./db.h"
|
||||||
@@ -61,6 +62,21 @@ void AqHomed_Loop(AQHOMED *aqh, int timeoutInMsecs)
|
|||||||
GWEN_MsgEndpoint_ChildrenIoLoop(aqh->rootEndpoint, timeoutInMsecs);
|
GWEN_MsgEndpoint_ChildrenIoLoop(aqh->rootEndpoint, timeoutInMsecs);
|
||||||
AqHomed_ReadAndHandleTtyMessages(aqh);
|
AqHomed_ReadAndHandleTtyMessages(aqh);
|
||||||
AqHomed_ReadAndHandleIpcMessages(aqh);
|
AqHomed_ReadAndHandleIpcMessages(aqh);
|
||||||
|
AqHomed_ReadAndHandleBrokerMessages(aqh);
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
DBG_ERROR(NULL, "Messages in TTY queue: %d in, %d out",
|
||||||
|
GWEN_Msg_List_GetCount(GWEN_MsgEndpoint_GetReceivedMessageList(aqh->ttyEndpoint)),
|
||||||
|
GWEN_Msg_List_GetCount(GWEN_MsgEndpoint_GetSendMessageList(aqh->ttyEndpoint)));
|
||||||
|
|
||||||
|
DBG_ERROR(NULL, "Messages in IPC queue: %d in, %d out",
|
||||||
|
GWEN_Msg_List_GetCount(GWEN_MsgEndpoint_GetReceivedMessageList(aqh->ipcdEndpoint)),
|
||||||
|
GWEN_Msg_List_GetCount(GWEN_MsgEndpoint_GetSendMessageList(aqh->ipcdEndpoint)));
|
||||||
|
|
||||||
|
DBG_ERROR(NULL, "Messages in Broker queue: %d in, %d out",
|
||||||
|
GWEN_Msg_List_GetCount(GWEN_MsgEndpoint_GetReceivedMessageList(aqh->brokerEndpoint)),
|
||||||
|
GWEN_Msg_List_GetCount(GWEN_MsgEndpoint_GetSendMessageList(aqh->brokerEndpoint)));
|
||||||
|
#endif
|
||||||
|
|
||||||
if (AQH_NodeDb_IsModified(aqh->nodeDb)) {
|
if (AQH_NodeDb_IsModified(aqh->nodeDb)) {
|
||||||
if (aqh->dbFile) {
|
if (aqh->dbFile) {
|
||||||
|
|||||||
76
apps/aqhome-nodes/loop_broker.c
Normal file
76
apps/aqhome-nodes/loop_broker.c
Normal file
@@ -0,0 +1,76 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
* This file is part of the project AqHome.
|
||||||
|
* AqHome (c) by 2023 Martin Preuss, all rights reserved.
|
||||||
|
*
|
||||||
|
* The license for this file can be found in the file COPYING which you
|
||||||
|
* should have received along with this file.
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
# include <config.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#include "./loop_broker.h"
|
||||||
|
#include "./aqhomed_p.h"
|
||||||
|
#include "./tty_log.h"
|
||||||
|
#include "./db.h"
|
||||||
|
|
||||||
|
#include "aqhome/msg/endpoint_tty.h"
|
||||||
|
#include "aqhome/msg/msg_node.h"
|
||||||
|
#include "aqhome/msg/msg_value2.h"
|
||||||
|
#include "aqhome/msg/msg_ping.h"
|
||||||
|
#include "aqhome/ipc/endpoint_ipc.h"
|
||||||
|
#include "aqhome/ipc/msg_ipc_result.h"
|
||||||
|
|
||||||
|
#include <gwenhywfar/gwenhywfar.h>
|
||||||
|
#include <gwenhywfar/args.h>
|
||||||
|
#include <gwenhywfar/debug.h>
|
||||||
|
#include <gwenhywfar/endpoint_tcpd.h>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* ------------------------------------------------------------------------------------------------
|
||||||
|
* defines
|
||||||
|
* ------------------------------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* ------------------------------------------------------------------------------------------------
|
||||||
|
* forward declarations
|
||||||
|
* ------------------------------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* ------------------------------------------------------------------------------------------------
|
||||||
|
* implementations
|
||||||
|
* ------------------------------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
void AqHomed_ReadAndHandleBrokerMessages(AQHOMED *aqh)
|
||||||
|
{
|
||||||
|
if (aqh->brokerEndpoint) {
|
||||||
|
GWEN_MSG_ENDPOINT *epTcp;
|
||||||
|
GWEN_MSG *msg;
|
||||||
|
|
||||||
|
epTcp=aqh->brokerEndpoint;
|
||||||
|
while( (msg=GWEN_MsgEndpoint_TakeFirstReceivedMessage(epTcp)) ) {
|
||||||
|
uint16_t code;
|
||||||
|
|
||||||
|
code=GWEN_IpcMsg_GetCode(msg);
|
||||||
|
DBG_DEBUG(AQH_LOGDOMAIN, "Received IPC packet %d (%x)", (int) code, code);
|
||||||
|
|
||||||
|
GWEN_Msg_free(msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
23
apps/aqhome-nodes/loop_broker.h
Normal file
23
apps/aqhome-nodes/loop_broker.h
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
* This file is part of the project AqHome.
|
||||||
|
* AqHome (c) by 2023 Martin Preuss, all rights reserved.
|
||||||
|
*
|
||||||
|
* The license for this file can be found in the file COPYING which you
|
||||||
|
* should have received along with this file.
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#ifndef AQHOMED_LOOP_BROKER_H
|
||||||
|
#define AQHOMED_LOOP_BROKER_H
|
||||||
|
|
||||||
|
|
||||||
|
#include "./aqhomed.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void AqHomed_ReadAndHandleBrokerMessages(AQHOMED *aqh);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
Reference in New Issue
Block a user