clients not on EC2 box should be talked to at public address

This commit is contained in:
Stephen Birarda 2013-06-18 13:32:17 -07:00
parent 5e8e50e53b
commit 350ebfb80f

View file

@ -103,6 +103,8 @@ int main(int argc, const char * argv[])
int numBytesSocket = unpackSocket(packetData + sizeof(PACKET_HEADER) + sizeof(AGENT_TYPE),
(sockaddr*) &agentLocalAddress);
sockaddr* destinationSocket = (sockaddr*) &agentPublicAddress;
// check the agent public address
// if it matches our local address we're on the same box
// so hardcode the EC2 public address for now
@ -111,6 +113,7 @@ int main(int argc, const char * argv[])
// with the EC2 IP. Otherwise, we use our normal public IP
if (!isLocalMode) {
agentPublicAddress.sin_addr.s_addr = 895283510; // local IP in this format...
destinationSocket = (sockaddr*) &agentLocalAddress;
}
}
@ -177,8 +180,6 @@ 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(destinationSocket,
broadcastPacket,