Skip to content

Commit 8e02413

Browse files
[Gate] Allow to receive and manage someone excluding the Gate
1 parent a3bc2c3 commit 8e02413

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

tool_services/gate/data_manager.c

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,33 @@ void DataManager_Format(service_t *service)
227227
}
228228
i++;
229229
}
230+
if (Luos_NbrAvailableMsg() != 0)
231+
{
232+
// 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.
233+
// Luos_ReadFromService(service, BROADCAST_VAL, &data_msg);
234+
if (Luos_ReadFromCmd(service, DEADTARGET, &data_msg) == SUCCEED)
235+
{
236+
dead_target_t *dead_target = (dead_target_t *)data_msg.data;
237+
if (dead_target->node_id != 0)
238+
{
239+
Convert_DeadNodeToData(service, dead_target->node_id);
240+
}
241+
if (dead_target->service_id != 0)
242+
{
243+
if (dead_target->service_id == service->id)
244+
{
245+
// This is the exclusion of our Gate service!
246+
// This mean that the gate is not able to communicate with anything anymore and looks like dead.
247+
// To avoid it we will remake the detection.
248+
Luos_Detect(service);
249+
}
250+
else
251+
{
252+
Convert_DeadServiceToData(service, dead_target->service_id);
253+
}
254+
}
255+
}
256+
}
230257
if (data_ok)
231258
{
232259
Convert_EndData(service, data, data_ptr);

0 commit comments

Comments
 (0)