From 58dc2cc84a4237b626a1505a473368eea0a7069a Mon Sep 17 00:00:00 2001 From: Vftdan Date: Sun, 18 Aug 2024 18:03:46 +0200 Subject: [PATCH] Reverse "router" node predicate handling order to compensate for the replication at the past end Make the behaviour inline with other tee-like nodes: order replicas ascending along output connectors --- nodes/router.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/nodes/router.c b/nodes/router.c index 2e29d5f..5cd59b8 100644 --- a/nodes/router.c +++ b/nodes/router.c @@ -11,9 +11,9 @@ static bool handle_event(EventPositionBase * self, EventNode * event) { RouterGraphNode *node = DOWNCAST(RouterGraphNode, GraphNode, DOWNCAST(GraphNode, EventPositionBase, self)); - for (size_t i = 0; i < node->length; ++i) { - if (i >= node->as_GraphNode.outputs.length) { - break; + for (ssize_t i = node->length - 1; i >= 0; --i) { + if ((size_t) i >= node->as_GraphNode.outputs.length) { + continue; } if (event_predicate_apply(node->predicates[i], event) == EVPREDRES_ACCEPTED) { if (event_replicate(event, 1)) {