Read config file for fallback when no command line arguments are given.
This commit is contained in:
@@ -32,15 +32,39 @@
|
||||
|
||||
|
||||
|
||||
GWEN_MSG_ENDPOINT *Utils_SetupIpcEndpoint(GWEN_DB_NODE *dbArgs)
|
||||
GWEN_MSG_ENDPOINT *Utils_SetupBrokerClientEndpoint(GWEN_DB_NODE *dbArgs)
|
||||
{
|
||||
return Utils_SetupIpcEndpoint(dbArgs, "tcpAddress", "tcpPort", "ConfigFile/brokerAddress", "ConfigFile/brokerPort", 1899);
|
||||
}
|
||||
|
||||
|
||||
|
||||
GWEN_MSG_ENDPOINT *Utils_SetupNodesClientEndpoint(GWEN_DB_NODE *dbArgs)
|
||||
{
|
||||
return Utils_SetupIpcEndpoint(dbArgs, "tcpAddress", "tcpPort", "ConfigFile/nodesAddress", "ConfigFile/nodesPort", 45454);
|
||||
}
|
||||
|
||||
|
||||
|
||||
GWEN_MSG_ENDPOINT *Utils_SetupIpcEndpoint(GWEN_DB_NODE *dbArgs,
|
||||
const char *varNameAddr,
|
||||
const char *varNamePort,
|
||||
const char *fileVarNameAddr,
|
||||
const char *fileVarNamePort,
|
||||
int defaultPort)
|
||||
{
|
||||
GWEN_MSG_ENDPOINT *epTcp;
|
||||
const char *tcpAddress;
|
||||
int tcpPort;
|
||||
int rv;
|
||||
|
||||
tcpAddress=GWEN_DB_GetCharValue(dbArgs, "tcpAddress", 0, "127.0.0.1");
|
||||
tcpPort=GWEN_DB_GetIntValue(dbArgs, "tcpPort", 0, 45454);
|
||||
tcpAddress=GWEN_DB_GetCharValue(dbArgs, varNameAddr, 0, NULL);
|
||||
if (!(tcpAddress && *tcpAddress))
|
||||
tcpAddress=GWEN_DB_GetCharValue(dbArgs, fileVarNameAddr, 0, "127.0.0.1");
|
||||
|
||||
tcpPort=GWEN_DB_GetIntValue(dbArgs, varNamePort, 0, -1);
|
||||
if (tcpPort<0)
|
||||
tcpPort=GWEN_DB_GetIntValue(dbArgs, fileVarNamePort, 0, defaultPort);
|
||||
|
||||
DBG_INFO(NULL, "Setup tcp client endpoint to %s:%d", tcpAddress, tcpPort);
|
||||
epTcp=AQH_IpcEndpoint_CreateIpcTcpClient(tcpAddress, tcpPort, "aqhome-tool-IPC", 0);
|
||||
@@ -190,7 +214,7 @@ int Utils_SendAcceptedMsgGroups(GWEN_MSG_ENDPOINT *epTcp, uint32_t groups)
|
||||
|
||||
|
||||
|
||||
GWEN_MSG_ENDPOINT *Utils_OpenConnection(GWEN_DB_NODE *dbArgs, uint32_t flags, int timeoutInSeconds)
|
||||
GWEN_MSG_ENDPOINT *Utils_OpenBrokerConnection(GWEN_DB_NODE *dbArgs, uint32_t flags, int timeoutInSeconds)
|
||||
{
|
||||
GWEN_MSG_ENDPOINT *epTcp;
|
||||
GWEN_MSG *msgOut;
|
||||
@@ -204,7 +228,7 @@ GWEN_MSG_ENDPOINT *Utils_OpenConnection(GWEN_DB_NODE *dbArgs, uint32_t flags, in
|
||||
userId=GWEN_DB_GetCharValue(dbArgs, "userId", 0, NULL);
|
||||
password=GWEN_DB_GetCharValue(dbArgs, "password", 0, NULL);
|
||||
|
||||
epTcp=Utils_SetupIpcEndpoint(dbArgs);
|
||||
epTcp=Utils_SetupBrokerClientEndpoint(dbArgs);
|
||||
if (epTcp==NULL) {
|
||||
DBG_ERROR(NULL, "ERROR creating TCP connection");
|
||||
return NULL;
|
||||
|
||||
Reference in New Issue
Block a user