Assertion rsample_is_singleton fails

Caused by the changes in a652ecb78e; the
sample that matters is the first in what may now be a chain of samples,
which requires some overlooked adjustments.

Signed-off-by: Erik Boasson <eb@ilities.com>
This commit is contained in:
Erik Boasson 2019-07-18 19:16:43 +02:00 committed by eboasson
parent d494ba4eda
commit 774dae135b
3 changed files with 8 additions and 5 deletions

View file

@ -217,7 +217,7 @@ int nn_defrag_nackmap (struct nn_defrag *defrag, seqno_t seq, uint32_t maxfragnu
struct nn_reorder *nn_reorder_new (enum nn_reorder_mode mode, uint32_t max_samples);
void nn_reorder_free (struct nn_reorder *r);
struct nn_rsample *nn_reorder_rsample_dup (struct nn_rmsg *rmsg, struct nn_rsample *rsampleiv);
struct nn_rsample *nn_reorder_rsample_dup_first (struct nn_rmsg *rmsg, struct nn_rsample *rsampleiv);
struct nn_rdata *nn_rsample_fragchain (struct nn_rsample *rsample);
nn_reorder_result_t nn_reorder_rsample (struct nn_rsample_chain *sc, struct nn_reorder *reorder, struct nn_rsample *rsampleiv, int *refcount_adjust, int delivery_queue_full_p);
nn_reorder_result_t nn_reorder_gap (struct nn_rsample_chain *sc, struct nn_reorder *reorder, struct nn_rdata *rdata, seqno_t min, seqno_t maxp1, int *refcount_adjust);

View file

@ -1726,7 +1726,7 @@ static int reorder_try_append_and_discard (struct nn_reorder *reorder, struct nn
}
}
struct nn_rsample *nn_reorder_rsample_dup (struct nn_rmsg *rmsg, struct nn_rsample *rsampleiv)
struct nn_rsample *nn_reorder_rsample_dup_first (struct nn_rmsg *rmsg, struct nn_rsample *rsampleiv)
{
/* Duplicates the rsampleiv without updating any reference counts:
that is left to the caller, as they do not need to be updated if
@ -1738,7 +1738,6 @@ struct nn_rsample *nn_reorder_rsample_dup (struct nn_rmsg *rmsg, struct nn_rsamp
rsampleiv. */
struct nn_rsample *rsampleiv_new;
struct nn_rsample_chain_elem *sce;
assert (rsample_is_singleton (&rsampleiv->u.reorder));
#ifndef NDEBUG
{
struct nn_rdata *d = rsampleiv->u.reorder.sc.first->fragchain;
@ -1754,7 +1753,9 @@ struct nn_rsample *nn_reorder_rsample_dup (struct nn_rmsg *rmsg, struct nn_rsamp
sce->fragchain = rsampleiv->u.reorder.sc.first->fragchain;
sce->next = NULL;
sce->sampleinfo = rsampleiv->u.reorder.sc.first->sampleinfo;
*rsampleiv_new = *rsampleiv;
rsampleiv_new->u.reorder.min = rsampleiv->u.reorder.min;
rsampleiv_new->u.reorder.maxp1 = rsampleiv_new->u.reorder.min + 1;
rsampleiv_new->u.reorder.n_samples = 1;
rsampleiv_new->u.reorder.sc.first = rsampleiv_new->u.reorder.sc.last = sce;
return rsampleiv_new;
}

View file

@ -2201,8 +2201,10 @@ static void handle_regular (struct receiver_state *rst, nn_etime_t tnow, struct
nn_reorder_result_t rres2;
if (wn->in_sync == PRMSS_SYNC)
continue;
/* only need to get a copy of the first sample, because that's the one
that triggered delivery */
if (!reuse_rsample_dup)
rsample_dup = nn_reorder_rsample_dup (rmsg, rsample);
rsample_dup = nn_reorder_rsample_dup_first (rmsg, rsample);
rres2 = nn_reorder_rsample (&sc, wn->u.not_in_sync.reorder, rsample_dup, &refc_adjust, nn_dqueue_is_full (pwr->dqueue));
switch (rres2)
{