the EC2 domain server should send to the Agent's local socket

This commit is contained in:
Stephen Birarda 2013-06-18 13:11:31 -07:00
parent 49b9471d0c
commit 5e8e50e53b

View file

@ -65,8 +65,8 @@ int main(int argc, const char * argv[])
// 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 useLocal = cmdOptionExists(argc, argv, "--local");
if (useLocal) {
bool isLocalMode = cmdOptionExists(argc, argv, "--local");
if (isLocalMode) {
printf("NOTE: Running in Local Mode!\n");
} else {
printf("--------------------------------------------------\n");
@ -109,7 +109,7 @@ int main(int argc, const char * argv[])
if (agentPublicAddress.sin_addr.s_addr == serverLocalAddress) {
// If we're not running "local" then we do replace the IP
// with the EC2 IP. Otherwise, we use our normal public IP
if (!useLocal) {
if (!isLocalMode) {
agentPublicAddress.sin_addr.s_addr = 895283510; // local IP in this format...
}
}
@ -177,10 +177,12 @@ int main(int argc, const char * argv[])
// add the agent ID to the end of the pointer
currentBufferPos += packAgentId(currentBufferPos, newAgent->getAgentID());
sockaddr* destinationSocket = (sockaddr*) (isLocalMode ? &agentPublicAddress : &agentLocalAddress);
// send the constructed list back to this agent
agentList->getAgentSocket()->send((sockaddr*) &agentPublicAddress,
broadcastPacket,
(currentBufferPos - startPointer) + 1);
agentList->getAgentSocket()->send(destinationSocket,
broadcastPacket,
(currentBufferPos - startPointer) + 1);
}
}