From 350ebfb80ffd2c6dc5b960397c1ff3df3f16f9aa Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Tue, 18 Jun 2013 13:32:17 -0700 Subject: [PATCH] clients not on EC2 box should be talked to at public address --- domain-server/src/main.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/domain-server/src/main.cpp b/domain-server/src/main.cpp index 028f4cb508..2ea7ecf9f6 100644 --- a/domain-server/src/main.cpp +++ b/domain-server/src/main.cpp @@ -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,