Skip to content

Commit

Permalink
[Gate] Allow to receive and manage someone excluding the Gate
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolas-rabault committed Jan 3, 2024
1 parent 44cda44 commit 649161e
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions tool_services/gate/data_manager.c
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,33 @@ void DataManager_Format(service_t *service)
}
i++;
}
if (Luos_NbrAvailableMsg() != 0)
{
// We still have messages.This could be because we received some during the execution of the last loop.Or this could be because the gate have been excluded from the routing table, let's try to catch some message for the Gate service.
// Luos_ReadFromService(service, BROADCAST_VAL, &data_msg);
if (Luos_ReadFromCmd(service, DEADTARGET, &data_msg) == SUCCEED)
{
dead_target_t *dead_target = (dead_target_t *)data_msg.data;
if (dead_target->node_id != 0)
{
Convert_DeadNodeToData(service, dead_target->node_id);
}
if (dead_target->service_id != 0)
{
if (dead_target->service_id == service->id)
{
// This is the exclusion of our Gate service!
// This mean that the gate is not able to communicate with anything anymore and looks like dead.
// To avoid it we will remake the detection.
Luos_Detect(service);
}
else
{
Convert_DeadServiceToData(service, dead_target->service_id);
}
}
}
}
if (data_ok)
{
Convert_EndData(service, data, data_ptr);
Expand Down

0 comments on commit 649161e

Please sign in to comment.