Prevent two agents from being each other's parents.
(cherry picked from commit 121c3a1af8
)
This commit is contained in:
parent
2ffcd12bac
commit
b1b605018f
|
@ -1080,8 +1080,18 @@ sub connect_pandora_agents($$$$) {
|
|||
}
|
||||
|
||||
# Update parents.
|
||||
if (!defined($PARENTS{$agent_2->{'id_agente'}}) &&
|
||||
(!defined($PARENTS{$agent_1->{'id_agente'}}) ||
|
||||
$PARENTS{$agent_1->{'id_agente'}} != $agent_2->{'id_agente'})) {
|
||||
$PARENTS{$agent_2->{'id_agente'}} = $agent_1->{'id_agente'};
|
||||
db_do($DBH, 'UPDATE tagente SET id_parent=? WHERE id_agente=?', $agent_1->{'id_agente'}, $agent_2->{'id_agente'});
|
||||
} elsif (!defined($PARENTS{$agent_1->{'id_agente'}}) &&
|
||||
(!defined($PARENTS{$agent_2->{'id_agente'}}) ||
|
||||
$PARENTS{$agent_2->{'id_agente'}} != $agent_1->{'id_agente'})) {
|
||||
$PARENTS{$agent_1->{'id_agente'}} = $agent_2->{'id_agente'};
|
||||
db_do($DBH, 'UPDATE tagente SET id_parent=? WHERE id_agente=?', $agent_2->{'id_agente'}, $agent_1->{'id_agente'});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
##########################################################################
|
||||
|
|
Loading…
Reference in New Issue