Bluetooth: Mesh: Fix publish timer handling when sending fails

Sending a model publication message could fail e.g. if there are no
buffers available, however this doesn't mean that we should stop doing
periodic publishing indefinitely. When an error occurs, make sure to
call the publish_sent() function so that the periodic publishing timer
gets resubmitted if necessary.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
This commit is contained in:
Johan Hedberg 2019-01-26 11:37:56 +02:00 committed by Johan Hedberg
commit 9abce3ec58

View file

@ -706,7 +706,10 @@ int bt_mesh_model_publish(struct bt_mesh_model *model)
err = model_send(model, &tx, true, &sdu, &pub_sent_cb, model);
if (err) {
/* Don't try retransmissions for this publish attempt */
pub->count = 0;
/* Make sure the publish timer gets reset */
publish_sent(err, model);
return err;
}