mirror of
https://github.com/overte-org/overte.git
synced 2025-08-07 20:13:40 +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 ALLOWED_PARAMETERS[] = "p::";
|
||||||
const char POOL_PARAMETER_CHAR = 'p';
|
const char POOL_PARAMETER_CHAR = 'p';
|
||||||
|
|
||||||
char* poolParam = NULL;
|
char* assignmentPool = NULL;
|
||||||
|
|
||||||
while ((parameter = getopt(argc, argv, ALLOWED_PARAMETERS)) != -1) {
|
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) {
|
if (parameter == POOL_PARAMETER_CHAR) {
|
||||||
|
// copy the passed assignment pool
|
||||||
int poolLength = strlen(optarg);
|
int poolLength = strlen(optarg);
|
||||||
poolParam = new char[poolLength];
|
assignmentPool = new char[poolLength];
|
||||||
memcpy(poolParam, optarg, 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) {
|
while (true) {
|
||||||
if (usecTimestampNow() - usecTimestamp(&lastRequest) >= ASSIGNMENT_REQUEST_INTERVAL_USECS) {
|
if (usecTimestampNow() - usecTimestamp(&lastRequest) >= ASSIGNMENT_REQUEST_INTERVAL_USECS) {
|
||||||
|
|
|
@ -47,14 +47,14 @@ unsigned char* addNodeToBroadcastPacket(unsigned char* currentPosition, Node* no
|
||||||
return currentPosition;
|
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);
|
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
|
// 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
|
// 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
|
// this allows developers to run a local domain without recompiling the
|
||||||
// domain server
|
// domain server
|
||||||
bool isLocalMode = cmdOptionExists(argc, argv, "--local");
|
bool isLocalMode = cmdOptionExists(argc, (const char**) argv, "--local");
|
||||||
if (isLocalMode) {
|
if (isLocalMode) {
|
||||||
printf("NOTE: Running in local mode!\n");
|
printf("NOTE: Running in local mode!\n");
|
||||||
} else {
|
} else {
|
||||||
|
@ -85,13 +85,27 @@ int main(int argc, const char * argv[])
|
||||||
|
|
||||||
timeval lastStatSendTime = {};
|
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) {
|
while (true) {
|
||||||
|
|
||||||
if (!nodeList->soloNodeOfType(NODE_TYPE_AUDIO_MIXER)) {
|
if (!nodeList->soloNodeOfType(NODE_TYPE_AUDIO_MIXER)) {
|
||||||
// we don't have an audio mixer, and we know we need one
|
// create an assignment to send, ask for an audio mixer, pass the assignment pool if it exists
|
||||||
// so tell that to the assignment server
|
Assignment mixerAssignment(Assignment::Create, Assignment::AudioMixer, assignmentPool);
|
||||||
|
|
||||||
Assignment mixerAssignment(Assignment::Create, Assignment::AudioMixer);
|
|
||||||
nodeList->sendAssignment(mixerAssignment);
|
nodeList->sendAssignment(mixerAssignment);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue