aqhome apps: sending a message via aqhome-nodes to nodes now works.

This commit is contained in:
Martin Preuss
2025-03-10 23:22:30 +01:00
parent 541b5ee2ca
commit 9cca3af402
20 changed files with 376 additions and 37 deletions

View File

@@ -70,6 +70,45 @@ AQH_OBJECT *Utils2_SetupBrokerClientEndpoint(AQH_EVENT_LOOP *eventLoop, GWEN_DB_
AQH_OBJECT *Utils2_SetupNodesClientEndpoint(AQH_EVENT_LOOP *eventLoop, GWEN_DB_NODE *dbArgs, uint32_t flags)
{
const char *address;
int port;
address=GWEN_DB_GetCharValue(dbArgs, "tcpAddress", 0, NULL);
if (!(address && *address))
address=GWEN_DB_GetCharValue(dbArgs, "ConfigFile/nodesAddress", 0, "127.0.0.1");
port=GWEN_DB_GetIntValue(dbArgs, "tcpPort", 0, -1);
if (port<0)
port=GWEN_DB_GetIntValue(dbArgs, "ConfigFile/nodesPort", 0, 45456);
if (address && *address && port) {
AQH_OBJECT *ep;
int fd;
DBG_ERROR(NULL, "Connecting to nodes server %s:%d", address, port);
fd=AQH_TcpObject_CreateConnectedSocket(address, port);
if (fd<0) {
DBG_ERROR(NULL, "Error connecting to nodes server %s:%d", address, port);
return NULL;
}
DBG_ERROR(NULL, "Connected to nodes server %s:%d", address, port);
ep=AQH_IpcClientObject_new(eventLoop, fd);
assert(ep);
AQH_Endpoint_AddFlags(ep, flags);
return ep;
}
else {
DBG_ERROR(NULL, "No server settings");
}
return NULL;
}
int Utils_SendAcceptedMsgGroups(AQH_OBJECT *ep, uint32_t groups)
{
AQH_MESSAGE *msgOut;