node: move roam-events to dedicated struct
[project/usteer.git] / node.c
diff --git a/node.c b/node.c
index 8e0b30d436100bb6eefda0e43ee092ad55a12b48..8fd10696e4d98ca8920e048067f5492b6cc24763 100644 (file)
--- a/node.c
+++ b/node.c
@@ -60,8 +60,8 @@ usteer_node_higher_roamability(struct usteer_node *node, struct usteer_node *ref
 {
        uint64_t roamability_node, roamability_ref;
 
-       roamability_node = ((uint64_t)(node->roam_source + node->roam_destination)) * current_time / ((current_time - node->created) + 1);
-       roamability_ref = ((uint64_t)(ref->roam_source + ref->roam_destination)) * current_time / ((current_time - ref->created) + 1);
+       roamability_node = ((uint64_t)(node->roam_events.source + node->roam_events.target)) * current_time / ((current_time - node->created) + 1);
+       roamability_ref = ((uint64_t)(ref->roam_events.source + ref->roam_events.target)) * current_time / ((current_time - ref->created) + 1);
 
        if (roamability_node < roamability_ref)
                return ref;
@@ -114,6 +114,10 @@ usteer_node_get_next_neighbor(struct usteer_node *current_node, struct usteer_no
                if (strcmp(current_node->ssid, rn->node.ssid))
                        continue;
 
+               /* Skip nodes which can't handle additional STA */
+               if (rn->node.max_assoc && rn->node.n_assoc >= rn->node.max_assoc)
+                       continue;
+
                /* Check if this node is ranked lower than the last one */
                n1 = usteer_node_better_neighbor(last, &rn->node);
                n2 = usteer_node_better_neighbor(&rn->node, last);