mirror of
https://github.com/AleziaKurdis/overte.git
synced 2025-04-07 04:53:28 +02:00
remove the global assignment-server for now to avoid confusion
This commit is contained in:
parent
f0b834881b
commit
32b507d2ac
4 changed files with 0 additions and 186 deletions
|
@ -14,7 +14,6 @@ set(CMAKE_AUTOMOC ON)
|
|||
|
||||
add_subdirectory(animation-server)
|
||||
add_subdirectory(assignment-client)
|
||||
add_subdirectory(assignment-server)
|
||||
add_subdirectory(domain-server)
|
||||
add_subdirectory(eve)
|
||||
add_subdirectory(interface)
|
||||
|
|
|
@ -1,13 +0,0 @@
|
|||
cmake_minimum_required(VERSION 2.8)
|
||||
|
||||
set(TARGET_NAME assignment-server)
|
||||
|
||||
set(ROOT_DIR ..)
|
||||
set(MACRO_DIR ${ROOT_DIR}/cmake/macros)
|
||||
|
||||
include(${MACRO_DIR}/SetupHifiProject.cmake)
|
||||
setup_hifi_project(${TARGET_NAME} TRUE)
|
||||
|
||||
# link in the shared library
|
||||
include(${MACRO_DIR}/LinkHifiLibrary.cmake)
|
||||
link_hifi_library(shared ${TARGET_NAME} ${ROOT_DIR})
|
|
@ -1,117 +0,0 @@
|
|||
//
|
||||
// main.cpp
|
||||
// assignment-server
|
||||
//
|
||||
// Created by Stephen Birarda on 7/1/13.
|
||||
// Copyright (c) 2013 High Fidelity, Inc. All rights reserved.
|
||||
//
|
||||
|
||||
#include <arpa/inet.h>
|
||||
#include <fstream>
|
||||
#include <deque>
|
||||
|
||||
#include <QtCore/QString>
|
||||
|
||||
#include <Assignment.h>
|
||||
#include <Logging.h>
|
||||
#include <PacketHeaders.h>
|
||||
#include <SharedUtil.h>
|
||||
#include <UDPSocket.h>
|
||||
|
||||
const int MAX_PACKET_SIZE_BYTES = 1400;
|
||||
const long long NUM_DEFAULT_ASSIGNMENT_STALENESS_USECS = 10 * 1000 * 1000;
|
||||
|
||||
int main(int argc, const char* argv[]) {
|
||||
|
||||
qInstallMessageHandler(Logging::verboseMessageHandler);
|
||||
|
||||
std::deque<Assignment*> assignmentQueue;
|
||||
|
||||
sockaddr_in senderSocket;
|
||||
unsigned char senderData[MAX_PACKET_SIZE_BYTES] = {};
|
||||
ssize_t receivedBytes = 0;
|
||||
|
||||
UDPSocket serverSocket(ASSIGNMENT_SERVER_PORT);
|
||||
|
||||
unsigned char assignmentPacket[MAX_PACKET_SIZE_BYTES];
|
||||
int numSendHeaderBytes = populateTypeAndVersion(assignmentPacket, PACKET_TYPE_DEPLOY_ASSIGNMENT);
|
||||
|
||||
while (true) {
|
||||
if (serverSocket.receive((sockaddr*) &senderSocket, &senderData, &receivedBytes)) {
|
||||
if (senderData[0] == PACKET_TYPE_REQUEST_ASSIGNMENT) {
|
||||
// construct the requested assignment from the packet data
|
||||
Assignment requestAssignment(senderData, receivedBytes);
|
||||
|
||||
qDebug() << "Received request for assignment:" << requestAssignment << "\n";
|
||||
qDebug() << "Current queue size is" << assignmentQueue.size() << "\n";
|
||||
|
||||
// make sure there are assignments in the queue at all
|
||||
if (assignmentQueue.size() > 0) {
|
||||
|
||||
std::deque<Assignment*>::iterator assignment = assignmentQueue.begin();
|
||||
|
||||
// enumerate assignments until we find one to give this client (if possible)
|
||||
while (assignment != assignmentQueue.end()) {
|
||||
|
||||
// if this assignment is stale then get rid of it and check the next one
|
||||
if (usecTimestampNow() - usecTimestamp(&((*assignment)->getTime()))
|
||||
>= NUM_DEFAULT_ASSIGNMENT_STALENESS_USECS) {
|
||||
delete *assignment;
|
||||
assignment = assignmentQueue.erase(assignment);
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if (requestAssignment.getType() == Assignment::AllTypes ||
|
||||
(*assignment)->getType() == requestAssignment.getType()) {
|
||||
// give this assignment out, either we have a type match or the requestor has said they will
|
||||
// take all types
|
||||
|
||||
// check if the requestor is on the same network as the destination for the assignment
|
||||
if (senderSocket.sin_addr.s_addr ==
|
||||
((sockaddr_in*) (*assignment)->getAttachedPublicSocket())->sin_addr.s_addr) {
|
||||
// if this is the case we remove the public socket on the assignment by setting it to NULL
|
||||
// this ensures the local IP and port sent to the requestor is the local address of destination
|
||||
(*assignment)->setAttachedPublicSocket(NULL);
|
||||
}
|
||||
|
||||
|
||||
int numAssignmentBytes = (*assignment)->packToBuffer(assignmentPacket + numSendHeaderBytes);
|
||||
|
||||
// send the assignment
|
||||
serverSocket.send((sockaddr*) &senderSocket,
|
||||
assignmentPacket,
|
||||
numSendHeaderBytes + numAssignmentBytes);
|
||||
|
||||
|
||||
// delete this assignment now that it has been sent out
|
||||
delete *assignment;
|
||||
// remove it from the deque and make the iterator the next assignment
|
||||
assignmentQueue.erase(assignment);
|
||||
|
||||
// stop looping - we've handed out an assignment
|
||||
break;
|
||||
} else {
|
||||
// push forward the iterator to check the next assignment
|
||||
assignment++;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (senderData[0] == PACKET_TYPE_CREATE_ASSIGNMENT && packetVersionMatch(senderData)) {
|
||||
// construct the create assignment from the packet data
|
||||
Assignment* createdAssignment = new Assignment(senderData, receivedBytes);
|
||||
|
||||
qDebug() << "Received a created assignment:" << *createdAssignment << "\n";
|
||||
qDebug() << "Current queue size is" << assignmentQueue.size() << "\n";
|
||||
|
||||
// assignment server is likely on a public server
|
||||
// assume that the address we now have for the sender is the public address/port
|
||||
// and store that with the assignment so it can be given to the requestor later if necessary
|
||||
createdAssignment->setAttachedPublicSocket((sockaddr*) &senderSocket);
|
||||
|
||||
// add this assignment to the queue
|
||||
assignmentQueue.push_back(createdAssignment);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -134,18 +134,6 @@ int main(int argc, const char* argv[]) {
|
|||
nodeList->startSilentNodeRemovalThread();
|
||||
|
||||
timeval lastStatSendTime = {};
|
||||
const char ASSIGNMENT_SERVER_OPTION[] = "-a";
|
||||
|
||||
// grab the overriden assignment-server hostname from argv, if it exists
|
||||
const char* customAssignmentServer = getCmdOption(argc, argv, ASSIGNMENT_SERVER_OPTION);
|
||||
if (customAssignmentServer) {
|
||||
sockaddr_in customAssignmentSocket = socketForHostnameAndHostOrderPort(customAssignmentServer, ASSIGNMENT_SERVER_PORT);
|
||||
nodeList->setAssignmentServerSocket((sockaddr*) &customAssignmentSocket);
|
||||
}
|
||||
|
||||
// use a map to keep track of iterations of silence for assignment creation requests
|
||||
const long long GLOBAL_ASSIGNMENT_REQUEST_INTERVAL_USECS = 1 * 1000 * 1000;
|
||||
timeval lastGlobalAssignmentRequest = {};
|
||||
|
||||
// as a domain-server we will always want an audio mixer and avatar mixer
|
||||
// setup the create assignments for those
|
||||
|
@ -430,49 +418,6 @@ int main(int argc, const char* argv[]) {
|
|||
}
|
||||
}
|
||||
|
||||
// if ASSIGNMENT_REQUEST_INTERVAL_USECS have passed since last global assignment request then fire off another
|
||||
if (usecTimestampNow() - usecTimestamp(&lastGlobalAssignmentRequest) >= GLOBAL_ASSIGNMENT_REQUEST_INTERVAL_USECS) {
|
||||
gettimeofday(&lastGlobalAssignmentRequest, NULL);
|
||||
|
||||
::assignmentQueueMutex.lock();
|
||||
|
||||
// go through our queue and see if there are any assignments to send to the global assignment server
|
||||
std::deque<Assignment*>::iterator assignment = ::assignmentQueue.begin();
|
||||
|
||||
while (assignment != assignmentQueue.end()) {
|
||||
|
||||
if ((*assignment)->getLocation() != Assignment::LocalLocation) {
|
||||
// attach our local socket to the assignment so the assignment-server can optionally hand it out
|
||||
(*assignment)->setAttachedLocalSocket((sockaddr*) &localSocket);
|
||||
|
||||
nodeList->sendAssignment(*(*assignment));
|
||||
|
||||
if ((*assignment)->getType() == Assignment::AgentType) {
|
||||
// if this is a script assignment we need to delete it to avoid a memory leak
|
||||
// or if there is more than one instance to send out, simpy decrease the number of instances
|
||||
if ((*assignment)->getNumberOfInstances() > 1) {
|
||||
(*assignment)->decrementNumberOfInstances();
|
||||
} else {
|
||||
::assignmentQueue.erase(assignment);
|
||||
delete *assignment;
|
||||
}
|
||||
} else if ((*assignment)->getType() == Assignment::VoxelServerType) {
|
||||
// this is a voxel server assignment
|
||||
// remove the assignment from the queue
|
||||
::assignmentQueue.erase(assignment);
|
||||
}
|
||||
|
||||
// stop looping, we've handed out an assignment
|
||||
break;
|
||||
} else {
|
||||
// push forward the iterator to check the next assignment
|
||||
assignment++;
|
||||
}
|
||||
}
|
||||
|
||||
::assignmentQueueMutex.unlock();
|
||||
}
|
||||
|
||||
if (Logging::shouldSendStats()) {
|
||||
if (usecTimestampNow() - usecTimestamp(&lastStatSendTime) >= (NODE_COUNT_STAT_INTERVAL_MSECS * 1000)) {
|
||||
// time to send our count of nodes and servers to logstash
|
||||
|
|
Loading…
Reference in a new issue