mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 04:57:23 +02:00
expand the same host comparison to check 127.0.0.1
This commit is contained in:
parent
81e0be7f85
commit
0d69e1cce0
1 changed files with 6 additions and 25 deletions
|
@ -90,21 +90,6 @@ int main(int argc, const char* argv[]) {
|
||||||
|
|
||||||
NodeList* nodeList = NodeList::createInstance(NODE_TYPE_DOMAIN, DOMAIN_LISTEN_PORT);
|
NodeList* nodeList = NodeList::createInstance(NODE_TYPE_DOMAIN, DOMAIN_LISTEN_PORT);
|
||||||
|
|
||||||
// If user asks to run in "local" mode then we do NOT replace the IP
|
|
||||||
// with the EC2 IP. Otherwise, we will replace the IP like we used to
|
|
||||||
// this allows developers to run a local domain without recompiling the
|
|
||||||
// domain server
|
|
||||||
bool isLocalMode = cmdOptionExists(argc, (const char**) argv, "--local");
|
|
||||||
if (isLocalMode) {
|
|
||||||
printf("NOTE: Running in local mode!\n");
|
|
||||||
} else {
|
|
||||||
printf("--------------------------------------------------\n");
|
|
||||||
printf("NOTE: Not running in local mode. \n");
|
|
||||||
printf("If you're a developer testing a local system, you\n");
|
|
||||||
printf("probably want to include --local on command line.\n");
|
|
||||||
printf("--------------------------------------------------\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
setvbuf(stdout, NULL, _IOLBF, 0);
|
setvbuf(stdout, NULL, _IOLBF, 0);
|
||||||
|
|
||||||
ssize_t receivedBytes = 0;
|
ssize_t receivedBytes = 0;
|
||||||
|
@ -200,16 +185,12 @@ int main(int argc, const char* argv[]) {
|
||||||
sockaddr* destinationSocket = (sockaddr*) &nodePublicAddress;
|
sockaddr* destinationSocket = (sockaddr*) &nodePublicAddress;
|
||||||
|
|
||||||
// check the node public address
|
// check the node public address
|
||||||
// if it matches our local address we're on the same box
|
// if it matches our local address
|
||||||
// so hardcode the EC2 public address for now
|
// or if it's the loopback address we're on the same box
|
||||||
if (nodePublicAddress.sin_addr.s_addr == serverLocalAddress) {
|
if (nodePublicAddress.sin_addr.s_addr == serverLocalAddress ||
|
||||||
// If we're not running "local" then we do replace the IP
|
nodePublicAddress.sin_addr.s_addr == htonl(INADDR_LOOPBACK)) {
|
||||||
// with 0. This designates to clients that the server is reachable
|
nodePublicAddress.sin_addr.s_addr = 0;
|
||||||
// at the same IP address
|
destinationSocket = (sockaddr*) &nodeLocalAddress;
|
||||||
if (!isLocalMode) {
|
|
||||||
nodePublicAddress.sin_addr.s_addr = 0;
|
|
||||||
destinationSocket = (sockaddr*) &nodeLocalAddress;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Node* newNode = nodeList->addOrUpdateNode((sockaddr*) &nodePublicAddress,
|
Node* newNode = nodeList->addOrUpdateNode((sockaddr*) &nodePublicAddress,
|
||||||
|
|
Loading…
Reference in a new issue