diff --git a/assignment-client/src/main.cpp b/assignment-client/src/main.cpp index ac34fb0723..d33bf10e2e 100644 --- a/assignment-client/src/main.cpp +++ b/assignment-client/src/main.cpp @@ -18,7 +18,7 @@ const long long ASSIGNMENT_REQUEST_INTERVAL_USECS = 1 * 1000 * 1000; -int main(int argc, char* const argv[]) { +int main(int argc, const char* argv[]) { setvbuf(stdout, NULL, _IOLBF, 0); @@ -33,21 +33,8 @@ int main(int argc, char* const argv[]) { unsigned char packetData[MAX_PACKET_SIZE]; ssize_t receivedBytes = 0; - // loop the parameters to see if we were passed a pool - int parameter = -1; - const char ALLOWED_PARAMETERS[] = "p::"; - const char POOL_PARAMETER_CHAR = 'p'; - - char* assignmentPool = NULL; - - while ((parameter = getopt(argc, argv, ALLOWED_PARAMETERS)) != -1) { - if (parameter == POOL_PARAMETER_CHAR) { - // copy the passed assignment pool - int poolLength = strlen(optarg); - assignmentPool = new char[poolLength + sizeof(char)]; - strcpy(assignmentPool, optarg); - } - } + // grab the assignment pool from argv, if it was passed + const char* assignmentPool = getCmdOption(argc, argv, "-p"); // create a request assignment, accept all assignments, pass the desired pool (if it exists) Assignment requestAssignment(Assignment::Request, Assignment::All, assignmentPool); diff --git a/domain-server/src/main.cpp b/domain-server/src/main.cpp index 882fa85098..4bb554ab53 100644 --- a/domain-server/src/main.cpp +++ b/domain-server/src/main.cpp @@ -48,7 +48,7 @@ unsigned char* addNodeToBroadcastPacket(unsigned char* currentPosition, Node* no return currentPosition; } -int main(int argc, char* const argv[]) { +int main(int argc, const char* argv[]) { 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 @@ -85,21 +85,11 @@ int main(int argc, char* const argv[]) { timeval lastStatSendTime = {}; - // loop the parameters to see if we were passed a pool for assignment - int parameter = -1; - const char ALLOWED_PARAMETERS[] = "p::-local::"; - const char POOL_PARAMETER_CHAR = 'p'; + // set our assignment pool from argv, if it exists + const char* assignmentPool = getCmdOption(argc, argv, "-p"); - char* assignmentPool = NULL; - - while ((parameter = getopt(argc, argv, ALLOWED_PARAMETERS)) != -1) { - if (parameter == POOL_PARAMETER_CHAR) { - // copy the passed assignment pool - int poolLength = strlen(optarg); - assignmentPool = new char[poolLength + sizeof(char)]; - strcpy(assignmentPool, optarg); - } - } + // grab the overriden assignment-server hostname from argv, if it exists + const char* assignmentServer = getCmdOption(argc, argv, "-a"); // use a map to keep track of iterations of silence for assignment creation requests const int ASSIGNMENT_SILENCE_MAX_ITERATIONS = 5; diff --git a/libraries/shared/src/NodeList.cpp b/libraries/shared/src/NodeList.cpp index db90856251..cd52ff8ded 100644 --- a/libraries/shared/src/NodeList.cpp +++ b/libraries/shared/src/NodeList.cpp @@ -375,7 +375,7 @@ int NodeList::processDomainServerList(unsigned char* packetData, size_t dataByte return readNodes; } -const char ASSIGNMENT_SERVER_HOSTNAME[] = "assignment.highfidelity.io"; +const char ASSIGNMENT_SERVER_HOSTNAME[] = "localhost"; const sockaddr_in assignmentServerSocket = socketForHostnameAndHostOrderPort(ASSIGNMENT_SERVER_HOSTNAME, ASSIGNMENT_SERVER_PORT);