cleanup pool grabbing for DS and AC

This commit is contained in:
Stephen Birarda 2013-09-06 15:21:55 -07:00
parent f18a40dc89
commit 3b78678a76
3 changed files with 9 additions and 32 deletions

View file

@ -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);

View file

@ -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;

View file

@ -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);