Skip to content

Commit 174facc

Browse files
Johan Hedbergjhedberg
authored andcommitted
Bluetooth: Mesh: Prioritize subnets with Node ID
Node ID advertising is short lived, so it's important to make sure that subnets that get it enabled are first in queue to start advertising. Signed-off-by: Johan Hedberg <[email protected]>
1 parent 86ac86c commit 174facc

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

subsys/bluetooth/host/mesh/proxy.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,9 @@ static struct bt_mesh_proxy_client *find_client(struct bt_conn *conn)
113113
}
114114

115115
#if defined(CONFIG_BT_MESH_GATT_PROXY)
116+
/* Next subnet in queue to be advertised */
117+
static int next_idx;
118+
116119
static int proxy_segment_and_send(struct bt_conn *conn, u8_t type,
117120
struct net_buf_simple *msg);
118121

@@ -341,6 +344,9 @@ void bt_mesh_proxy_identity_start(struct bt_mesh_subnet *sub)
341344
{
342345
sub->node_id = BT_MESH_NODE_IDENTITY_RUNNING;
343346
sub->node_id_start = k_uptime_get_32();
347+
348+
/* Prioritize the recently enabled subnet */
349+
next_idx = sub - bt_mesh.sub;
344350
}
345351

346352
void bt_mesh_proxy_identity_stop(struct bt_mesh_subnet *sub)
@@ -1041,7 +1047,6 @@ static bool advertise_subnet(struct bt_mesh_subnet *sub)
10411047

10421048
static struct bt_mesh_subnet *next_sub(void)
10431049
{
1044-
static int next_idx;
10451050
int i;
10461051

10471052
for (i = 0; i < ARRAY_SIZE(bt_mesh.sub); i++) {

0 commit comments

Comments
 (0)