mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 06:58:56 +02:00
remove notion of pool from assignment-server
This commit is contained in:
parent
ff6fd73187
commit
3149431e16
1 changed files with 23 additions and 36 deletions
|
@ -59,43 +59,30 @@ int main(int argc, const char* argv[]) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool eitherHasPool = ((*assignment)->getPool() || requestAssignment.getPool());
|
// check if the requestor is on the same network as the destination for the assignment
|
||||||
bool bothHavePool = ((*assignment)->getPool() && requestAssignment.getPool());
|
if (senderSocket.sin_addr.s_addr ==
|
||||||
|
((sockaddr_in*) (*assignment)->getAttachedPublicSocket())->sin_addr.s_addr) {
|
||||||
// make sure there is a pool match for the created and requested assignment
|
// if this is the case we remove the public socket on the assignment by setting it to NULL
|
||||||
// or that neither has a designated pool
|
// this ensures the local IP and port sent to the requestor is the local address of destination
|
||||||
if ((eitherHasPool && bothHavePool
|
(*assignment)->setAttachedPublicSocket(NULL);
|
||||||
&& strcmp((*assignment)->getPool(), requestAssignment.getPool()) == 0)
|
|
||||||
|| !eitherHasPool) {
|
|
||||||
|
|
||||||
// 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
|
|
||||||
assignment++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
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 if (senderData[0] == PACKET_TYPE_CREATE_ASSIGNMENT && packetVersionMatch(senderData)) {
|
} else if (senderData[0] == PACKET_TYPE_CREATE_ASSIGNMENT && packetVersionMatch(senderData)) {
|
||||||
|
|
Loading…
Reference in a new issue