mirror of
https://github.com/lubosz/overte.git
synced 2025-04-08 01:22:08 +02:00
allow passing of custom assignment-server to DS and AC
This commit is contained in:
parent
3b78678a76
commit
65ef778efd
4 changed files with 13 additions and 4 deletions
|
@ -36,6 +36,9 @@ int main(int argc, const char* argv[]) {
|
|||
// grab the assignment pool from argv, if it was passed
|
||||
const char* assignmentPool = getCmdOption(argc, argv, "-p");
|
||||
|
||||
// set the overriden assignment-server hostname from argv, if it exists
|
||||
nodeList->setAssignmentServerHostname(getCmdOption(argc, argv, "-a"));
|
||||
|
||||
// create a request assignment, accept all assignments, pass the desired pool (if it exists)
|
||||
Assignment requestAssignment(Assignment::Request, Assignment::All, assignmentPool);
|
||||
|
||||
|
|
|
@ -89,7 +89,7 @@ int main(int argc, const char* argv[]) {
|
|||
const char* assignmentPool = getCmdOption(argc, argv, "-p");
|
||||
|
||||
// grab the overriden assignment-server hostname from argv, if it exists
|
||||
const char* assignmentServer = getCmdOption(argc, argv, "-a");
|
||||
nodeList->setAssignmentServerHostname(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;
|
||||
|
|
|
@ -375,9 +375,7 @@ int NodeList::processDomainServerList(unsigned char* packetData, size_t dataByte
|
|||
return readNodes;
|
||||
}
|
||||
|
||||
const char ASSIGNMENT_SERVER_HOSTNAME[] = "localhost";
|
||||
const sockaddr_in assignmentServerSocket = socketForHostnameAndHostOrderPort(ASSIGNMENT_SERVER_HOSTNAME,
|
||||
ASSIGNMENT_SERVER_PORT);
|
||||
const char GLOBAL_ASSIGNMENT_SERVER_HOSTNAME[] = "assignment.highfidelity.io";
|
||||
|
||||
void NodeList::sendAssignment(Assignment& assignment) {
|
||||
unsigned char assignmentPacket[MAX_PACKET_SIZE];
|
||||
|
@ -388,6 +386,12 @@ void NodeList::sendAssignment(Assignment& assignment) {
|
|||
|
||||
int numHeaderBytes = populateTypeAndVersion(assignmentPacket, assignmentPacketType);
|
||||
int numAssignmentBytes = assignment.packToBuffer(assignmentPacket + numHeaderBytes);
|
||||
|
||||
// setup the assignmentServerSocket once, use a custom assignmentServerHostname if it is present
|
||||
static sockaddr_in assignmentServerSocket = socketForHostnameAndHostOrderPort((_assignmentServerHostname != NULL
|
||||
? (const char*) _assignmentServerHostname
|
||||
: GLOBAL_ASSIGNMENT_SERVER_HOSTNAME),
|
||||
ASSIGNMENT_SERVER_PORT);
|
||||
|
||||
_nodeSocket.send((sockaddr*) &assignmentServerSocket, assignmentPacket, numHeaderBytes + numAssignmentBytes);
|
||||
}
|
||||
|
|
|
@ -99,6 +99,7 @@ public:
|
|||
void sendDomainServerCheckIn();
|
||||
int processDomainServerList(unsigned char *packetData, size_t dataBytes);
|
||||
|
||||
void setAssignmentServerHostname(const char* serverHostname) { _assignmentServerHostname = serverHostname; }
|
||||
void sendAssignment(Assignment& assignment);
|
||||
|
||||
Node* nodeWithAddress(sockaddr *senderAddress);
|
||||
|
@ -151,6 +152,7 @@ private:
|
|||
pthread_t removeSilentNodesThread;
|
||||
pthread_t checkInWithDomainServerThread;
|
||||
int _numNoReplyDomainCheckIns;
|
||||
const char* _assignmentServerHostname;
|
||||
|
||||
void handlePingReply(sockaddr *nodeAddress);
|
||||
void timePingReply(sockaddr *nodeAddress, unsigned char *packetData);
|
||||
|
|
Loading…
Reference in a new issue