aqhome apps: sending a message via aqhome-nodes to nodes now works.
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user