mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 11:37:58 +02:00
don't delete last scripted assignment before it is sent out
This commit is contained in:
parent
e0e13fe2ed
commit
21fe7e6fe0
1 changed files with 12 additions and 8 deletions
|
@ -457,14 +457,13 @@ Assignment* DomainServer::deployableAssignmentForRequest(Assignment& requestAssi
|
|||
Assignment* deployableAssignment = *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 {
|
||||
// if there is more than one instance to send out, simply decrease the number of instances
|
||||
|
||||
if ((*assignment)->getNumberOfInstances() == 1) {
|
||||
_assignmentQueue.erase(assignment);
|
||||
delete *assignment;
|
||||
}
|
||||
|
||||
(*assignment)->decrementNumberOfInstances();
|
||||
} else {
|
||||
// remove the assignment from the queue
|
||||
_assignmentQueue.erase(assignment);
|
||||
|
@ -735,6 +734,11 @@ int DomainServer::run() {
|
|||
nodeList->getNodeSocket()->send((sockaddr*) &senderAddress,
|
||||
broadcastPacket,
|
||||
numHeaderBytes + numAssignmentBytes);
|
||||
|
||||
if (assignmentToDeploy->getNumberOfInstances() == 0) {
|
||||
// there are no more instances of this script to send out, delete it
|
||||
delete assignmentToDeploy;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue