Added ability to override internal UDP API bound host/port
This commit is contained in:
parent
28db254d7b
commit
b35d56cd8f
4 changed files with 17 additions and 2 deletions
|
@ -98,6 +98,12 @@ endif()
|
|||
if (DEFINED KILLONEXIT )
|
||||
add_definitions(-DKILLONEXIT=true)
|
||||
endif()
|
||||
if (DEFINED UDP_API_HOST )
|
||||
add_definitions(-DUDP_API_HOST=${UDP_API_HOST})
|
||||
endif()
|
||||
if (DEFINED UDP_API_PORT )
|
||||
add_definitions(-DUDP_API_PORT=${UDP_API_PORT})
|
||||
endif()
|
||||
|
||||
########################################
|
||||
# Build Variables - Thread Names #
|
||||
|
|
|
@ -157,3 +157,12 @@ static inline void show_stackframe(){}
|
|||
|
||||
#define SIMUL_TRACKS 20
|
||||
|
||||
|
||||
#ifndef UDP_API_HOST
|
||||
#define UDP_API_HOST "localhost"
|
||||
#endif
|
||||
|
||||
#ifndef UDP_API_PORT
|
||||
#define UDP_API_PORT 4242
|
||||
#endif
|
||||
|
||||
|
|
|
@ -383,7 +383,7 @@ int Controller::handleAPIConnection(Socket::Connection & conn){
|
|||
|
||||
void Controller::handleUDPAPI(void * np){
|
||||
Socket::UDPConnection uSock(true);
|
||||
if (!uSock.bind(4242, "localhost")){
|
||||
if (!uSock.bind(UDP_API_PORT, UDP_API_HOST)){
|
||||
FAIL_MSG("Could not open local API UDP socket - not all functionality will be available");
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -1602,7 +1602,7 @@ namespace Mist{
|
|||
if (newUA && ((now - myConn.connTime()) >= uaDelay || !myConn) && UA.size()){
|
||||
std::string APIcall = "{\"tag_sessid\":{\"" + tmpEx.getSessId() + "\":" + JSON::string_escape("UA:"+UA) + "}}";
|
||||
Socket::UDPConnection uSock;
|
||||
uSock.SetDestination("localhost", 4242);
|
||||
uSock.SetDestination(UDP_API_HOST, UDP_API_PORT);
|
||||
uSock.SendNow(APIcall);
|
||||
newUA = false;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue