-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Node Stall Ready check does not perform search in stall queue as intended #28
Comments
Admittedly, I'm a bit confused as to why the check for presence of Only one thing prevents bidib from (incorrectly) sending a message over a stalled node: All invocations of I can only guess the original intention. One possibility is that this should've been two checks: One check for the "stall" member of the node_state. Then, if the node is stalled, but the address of the stalled node or supernode is not yet present in the |
Reference to MSG_STALL in the bidib protocol: http://bidib.org/protokoll/bidib_general_messages.html This line looks suspicious, should probably be
The idea of When a Take the function discussed above in #28 (comment): libbidib/src/transmission/bidib_transmission_node_states.c Lines 108 to 130 in 9f39427
When a stalled node is found, the original
Otherwise, we reach the for-loop that zeros out the top of the libbidib/src/transmission/bidib_transmission_node_states.c Lines 122 to 127 in 9f39427
The outer while-loop repeats until a stalled node is found or all nodes in addr_stack have been considered.
As a result, the libbidib/src/transmission/bidib_transmission_node_states.c Lines 232 to 237 in 9f39427
|
When sending a message via a node, first bidib determines if the node is ready to send.
This involves, among other things, checking whether the node is stalled, or, whether a supernode of the node is stalled. The stall check is performed in a function here.
If the node or a supernode is stalled, the linked function returns false. A node is stalled if the member "stall" is true and the address_stack (input param to linked fct) is NOT contained in the member stall_affected_nodes_queue.
Thus, the linked fct attempts to find the addr_stack in the queue stall_affected_nodes_queue by using g_queue_find, see line 114. As the addr_stack is an array of 4 uint8_t's, a custom comparison function is used, as the comparison shall be element-wise, not a pointer comparison. This comparator is called
bidib_node_stall_queue_entry_equals
(see line 99ff.).The call to
g_queue_find
looks as follows:!g_queue_find(state->stall_affected_nodes_queue, bidib_node_stall_queue_entry_equals)
.Note that the element to find is not actually given here! This code just always returns true, the comparator is never called.
g_queue_find
is supposed to be called with the queue and the element to find (see here). To use a custom comparator, we need to useg_queue_find_custom
(see here). It shall be called like this:!g_queue_find_custom(state->stall_affected_nodes_queue, addr_stack, (GCompareFunc)bidib_node_stall_queue_entry_equals)
.The unit tests related to this part (bidib_send_tests) pass as the "stall" member is apparently sufficient to indicate whether the node is stalled or not. However, there's probably a reason for the existence of the stall_affected_nodes_queue, so this comparison call should be fixed.
The text was updated successfully, but these errors were encountered: