|
@@ -397,7 +397,10 @@ static void round1b_received(NodeCommState &nodest,
|
|
uint16_t prev_nodes = g_teems_config.weights[my_node_num].startweight;
|
|
uint16_t prev_nodes = g_teems_config.weights[my_node_num].startweight;
|
|
nodenum_t num_routing_nodes = g_teems_config.num_routing_nodes;
|
|
nodenum_t num_routing_nodes = g_teems_config.num_routing_nodes;
|
|
nodenum_t adjacent_nodes =
|
|
nodenum_t adjacent_nodes =
|
|
- (((prev_nodes == 0) || (prev_nodes == num_routing_nodes-1)) ? 1 : 2);
|
|
|
|
|
|
+ (((prev_nodes == 0) || (prev_nodes == num_routing_nodes-1)) ? 1 : 2);
|
|
|
|
+ if(num_routing_nodes==1) {
|
|
|
|
+ adjacent_nodes = 0;
|
|
|
|
+ }
|
|
if (nodes_received == adjacent_nodes && completed_prev_round) {
|
|
if (nodes_received == adjacent_nodes && completed_prev_round) {
|
|
route_state.step = ROUTE_ROUND_1B;
|
|
route_state.step = ROUTE_ROUND_1B;
|
|
void *cbpointer = route_state.cbpointer;
|
|
void *cbpointer = route_state.cbpointer;
|
|
@@ -579,7 +582,7 @@ static void send_round1_msgs(const uint8_t *msgs, const T *indices,
|
|
|
|
|
|
for (auto &routing_node: g_teems_config.routing_nodes) {
|
|
for (auto &routing_node: g_teems_config.routing_nodes) {
|
|
uint8_t weight = g_teems_config.weights[routing_node].weight;
|
|
uint8_t weight = g_teems_config.weights[routing_node].weight;
|
|
-
|
|
|
|
|
|
+
|
|
if (weight == 0) {
|
|
if (weight == 0) {
|
|
// This shouldn't happen, but just in case
|
|
// This shouldn't happen, but just in case
|
|
continue;
|
|
continue;
|
|
@@ -772,7 +775,7 @@ static void send_round1c_msgs(const uint8_t *msgs, const UidPriorityKey *indices
|
|
|
|
|
|
for (auto &routing_node: g_teems_config.routing_nodes) {
|
|
for (auto &routing_node: g_teems_config.routing_nodes) {
|
|
uint8_t weight = g_teems_config.weights[routing_node].weight;
|
|
uint8_t weight = g_teems_config.weights[routing_node].weight;
|
|
-
|
|
|
|
|
|
+
|
|
if (weight == 0) {
|
|
if (weight == 0) {
|
|
// This shouldn't happen, but just in case
|
|
// This shouldn't happen, but just in case
|
|
continue;
|
|
continue;
|
|
@@ -1006,7 +1009,10 @@ static void round1b_processing(void *cbpointer) {
|
|
round1b.completed_prev_round = true;
|
|
round1b.completed_prev_round = true;
|
|
nodenum_t nodes_received = round1b.nodes_received;
|
|
nodenum_t nodes_received = round1b.nodes_received;
|
|
nodenum_t adjacent_nodes =
|
|
nodenum_t adjacent_nodes =
|
|
- (((prev_nodes == 0) || (prev_nodes == num_routing_nodes-1)) ? 1 : 2);
|
|
|
|
|
|
+ (((prev_nodes == 0) || (prev_nodes == num_routing_nodes-1)) ? 1 : 2);
|
|
|
|
+ if(num_routing_nodes==1) {
|
|
|
|
+ adjacent_nodes = 0;
|
|
|
|
+ }
|
|
pthread_mutex_unlock(&round1b.mutex);
|
|
pthread_mutex_unlock(&round1b.mutex);
|
|
if (nodes_received == adjacent_nodes) {
|
|
if (nodes_received == adjacent_nodes) {
|
|
route_state.step = ROUTE_ROUND_1B;
|
|
route_state.step = ROUTE_ROUND_1B;
|