applet_have_more_data(appctx);
ret = -1;
}
- else
+ else {
+ HA_ATOMIC_INC(&ts->ref_cnt);
ret = peer_send_updatemsg(st, appctx, ts, st->update_id, new_pushed, use_timed);
+ HA_ATOMIC_DEC(&ts->ref_cnt);
+ }
if (ret <= 0) {
/* Insert <last> marker before <ts> to process it again
/* ... and that we didn't leave the update list for the tree */
if (MT_LIST_INLIST(&ts->upd)) {
link = mt_list_lock_full(&ts->upd);
+ if (HA_ATOMIC_LOAD(&ts->ref_cnt)) {
+ mt_list_unlock_full(&ts->upd, link);
+ goto out;
+ }
mt_list_unlock_link(link);
mt_list_unlock_self(&ts->upd);
}
* Peers will lock the element. So to the same here to avoid any conflict
*/
MT_LIST_DELETE(&ts->pend_updts);
+
if (MT_LIST_INLIST(&ts->upd)) {
link = mt_list_lock_full(&ts->upd);
+ if (HA_ATOMIC_LOAD(&ts->ref_cnt)) {
+ mt_list_unlock_full(&ts->upd, link);
+ goto requeue;
+ }
mt_list_unlock_link(link);
mt_list_unlock_self(&ts->upd);
}
MT_LIST_DELETE(&ts->pend_updts);
if (MT_LIST_INLIST(&ts->upd)) {
link = mt_list_lock_full(&ts->upd);
+ if (HA_ATOMIC_LOAD(&ts->ref_cnt)) {
+ mt_list_unlock_full(&ts->upd, link);
+ goto requeue;
+ }
mt_list_unlock_link(link);
mt_list_unlock_self(&ts->upd);
}