if (IS_ENABLED(CONFIG_BLE_MESH_GATT_PROXY) &&
bt_mesh_proxy_relay(&buf->b, dst)) {
- net_buf_unref(buf);
+ send_cb_finalize(cb, cb_data);
} else {
bt_mesh_adv_send(buf, cb, cb_data);
}
/* Notify completion if this only went
* through the Mesh Proxy.
*/
- if (cb) {
- if (cb->start) {
- cb->start(0, 0, cb_data);
- }
-
- if (cb->end) {
- cb->end(0, cb_data);
- }
- }
+ send_cb_finalize(cb, cb_data);
err = 0;
goto done;
void friend_cred_clear(struct friend_cred *cred);
int friend_cred_del(u16_t net_idx, u16_t addr);
+static inline void send_cb_finalize(const struct bt_mesh_send_cb *cb,
+ void *cb_data)
+{
+ if (!cb) {
+ return;
+ }
+
+ if (cb->start) {
+ cb->start(0, 0, cb_data);
+ }
+
+ if (cb->end) {
+ cb->end(0, cb_data);
+ }
+}
+
#endif /* _NET_H_ */
* out through the Friend Queue.
*/
net_buf_unref(buf);
+ send_cb_finalize(cb, cb_data);
return 0;
}
}
* there's no other way to track this (at least currently)
* with the Friend Queue.
*/
- if (cb) {
- if (cb->start) {
- cb->start(0, 0, cb_data);
- }
- if (cb->end) {
- cb->end(0, cb_data);
- }
- }
+ send_cb_finalize(cb, cb_data);
}
if (IS_ENABLED(CONFIG_BLE_MESH_NODE) && bt_mesh_is_provisioned()) {