@@ -56,6 +56,24 @@ static struct bt_mesh_proxy_role roles[CONFIG_BT_MAX_CONN];
56
56
57
57
static int conn_count ;
58
58
59
+ static void proxy_queue_put (struct bt_mesh_proxy_role * role , struct bt_mesh_adv * adv )
60
+ {
61
+ k_fifo_put (& role -> pending , & (adv -> gatt_bearer [bt_conn_index (role -> conn )]));
62
+ }
63
+
64
+ static struct bt_mesh_adv * proxy_queue_get (struct bt_mesh_proxy_role * role )
65
+ {
66
+ void * gatt_bearer ;
67
+
68
+ gatt_bearer = k_fifo_get (& role -> pending , K_NO_WAIT );
69
+ if (!gatt_bearer ) {
70
+ return NULL ;
71
+ }
72
+
73
+ return CONTAINER_OF (gatt_bearer , struct bt_mesh_adv ,
74
+ gatt_bearer [bt_conn_index (role -> conn )]);
75
+ }
76
+
59
77
static void proxy_sar_timeout (struct k_work * work )
60
78
{
61
79
struct bt_mesh_proxy_role * role ;
@@ -66,7 +84,7 @@ static void proxy_sar_timeout(struct k_work *work)
66
84
role = CONTAINER_OF (dwork , struct bt_mesh_proxy_role , sar_timer );
67
85
68
86
while (!k_fifo_is_empty (& role -> pending )) {
69
- struct bt_mesh_adv * adv = k_fifo_get ( & role -> pending , K_NO_WAIT );
87
+ struct bt_mesh_adv * adv = proxy_queue_get ( role );
70
88
71
89
__ASSERT_NO_MSG (adv );
72
90
@@ -243,7 +261,7 @@ int bt_mesh_proxy_relay_send(struct bt_conn *conn, struct bt_mesh_adv *adv)
243
261
{
244
262
struct bt_mesh_proxy_role * role = & roles [bt_conn_index (conn )];
245
263
246
- k_fifo_put ( & role -> pending , bt_mesh_adv_ref (adv ));
264
+ proxy_queue_put ( role , bt_mesh_adv_ref (adv ));
247
265
248
266
bt_mesh_wq_submit (& role -> work );
249
267
@@ -259,7 +277,7 @@ static void proxy_msg_send_pending(struct k_work *work)
259
277
return ;
260
278
}
261
279
262
- adv = k_fifo_get ( & role -> pending , K_NO_WAIT );
280
+ adv = proxy_queue_get ( role );
263
281
if (!adv ) {
264
282
return ;
265
283
}
0 commit comments