mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-04-10 10:34:56 +02:00
add assignment pool passing to DS, cleanup in AS
This commit is contained in:
parent
bc5ad37395
commit
9260bee653
2 changed files with 26 additions and 11 deletions
|
@ -32,18 +32,19 @@ int main(int argc, char* const argv[]) {
|
|||
const char ALLOWED_PARAMETERS[] = "p::";
|
||||
const char POOL_PARAMETER_CHAR = 'p';
|
||||
|
||||
char* poolParam = NULL;
|
||||
char* assignmentPool = NULL;
|
||||
|
||||
while ((parameter = getopt(argc, argv, ALLOWED_PARAMETERS)) != -1) {
|
||||
// while we only have one allowed param there is no need to check if this was 'p'
|
||||
if (parameter == POOL_PARAMETER_CHAR) {
|
||||
// copy the passed assignment pool
|
||||
int poolLength = strlen(optarg);
|
||||
poolParam = new char[poolLength];
|
||||
memcpy(poolParam, optarg, poolLength);
|
||||
assignmentPool = new char[poolLength];
|
||||
memcpy(assignmentPool, optarg, poolLength);
|
||||
}
|
||||
}
|
||||
|
||||
Assignment requestAssignment(Assignment::Request, Assignment::All, poolParam);
|
||||
// create a request assignment, accept all assignments, pass the desired pool (if it exists)
|
||||
Assignment requestAssignment(Assignment::Request, Assignment::All, assignmentPool);
|
||||
|
||||
while (true) {
|
||||
if (usecTimestampNow() - usecTimestamp(&lastRequest) >= ASSIGNMENT_REQUEST_INTERVAL_USECS) {
|
||||
|
|
|
@ -47,14 +47,14 @@ unsigned char* addNodeToBroadcastPacket(unsigned char* currentPosition, Node* no
|
|||
return currentPosition;
|
||||
}
|
||||
|
||||
int main(int argc, const char * argv[])
|
||||
int main(int argc, char* const 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
|
||||
// this allows developers to run a local domain without recompiling the
|
||||
// domain server
|
||||
bool isLocalMode = cmdOptionExists(argc, argv, "--local");
|
||||
bool isLocalMode = cmdOptionExists(argc, (const char**) argv, "--local");
|
||||
if (isLocalMode) {
|
||||
printf("NOTE: Running in local mode!\n");
|
||||
} else {
|
||||
|
@ -85,13 +85,27 @@ int main(int argc, const char * argv[])
|
|||
|
||||
timeval lastStatSendTime = {};
|
||||
|
||||
// loop the parameters to see if we were passed a pool for assignment
|
||||
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];
|
||||
memcpy(assignmentPool, optarg, poolLength);
|
||||
}
|
||||
}
|
||||
|
||||
while (true) {
|
||||
|
||||
if (!nodeList->soloNodeOfType(NODE_TYPE_AUDIO_MIXER)) {
|
||||
// we don't have an audio mixer, and we know we need one
|
||||
// so tell that to the assignment server
|
||||
|
||||
Assignment mixerAssignment(Assignment::Create, Assignment::AudioMixer);
|
||||
// create an assignment to send, ask for an audio mixer, pass the assignment pool if it exists
|
||||
Assignment mixerAssignment(Assignment::Create, Assignment::AudioMixer, assignmentPool);
|
||||
nodeList->sendAssignment(mixerAssignment);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue