Do not update match counts on redundant unmatch

Dropping a match from a data reader generated unregisters and signalled
a SUBSCRIPTION_MATCHED event even when another thread raced it and did
so before.  The consequence is possible undercounting of the number of
matched writers.

Signed-off-by: Erik Boasson <eb@ilities.com>
This commit is contained in:
Erik Boasson 2019-08-25 09:24:43 +02:00 committed by eboasson
parent 87398bdc98
commit 8ae5f706d0

View file

@ -1454,8 +1454,8 @@ static void reader_drop_connection (const struct nn_guid *rd_guid, const struct
if ((m = ddsrt_avl_lookup (&rd_writers_treedef, &rd->writers, &pwr->e.guid)) != NULL)
ddsrt_avl_delete (&rd_writers_treedef, &rd->writers, m);
ddsrt_mutex_unlock (&rd->e.lock);
free_rd_pwr_match (pwr->e.gv, m);
if (m != NULL)
{
if (rd->rhc)
{
struct proxy_writer_info pwr_info;
@ -1476,6 +1476,8 @@ static void reader_drop_connection (const struct nn_guid *rd_guid, const struct
(rd->status_cb) (rd->status_cb_entity, &data);
}
}
free_rd_pwr_match (pwr->e.gv, m);
}
}
static void reader_drop_local_connection (const struct nn_guid *rd_guid, const struct writer *wr)
@ -1488,8 +1490,8 @@ static void reader_drop_local_connection (const struct nn_guid *rd_guid, const s
if ((m = ddsrt_avl_lookup (&rd_local_writers_treedef, &rd->local_writers, &wr->e.guid)) != NULL)
ddsrt_avl_delete (&rd_local_writers_treedef, &rd->local_writers, m);
ddsrt_mutex_unlock (&rd->e.lock);
free_rd_wr_match (m);
if (m != NULL)
{
if (rd->rhc)
{
/* FIXME: */
@ -1511,6 +1513,8 @@ static void reader_drop_local_connection (const struct nn_guid *rd_guid, const s
(rd->status_cb) (rd->status_cb_entity, &data);
}
}
free_rd_wr_match (m);
}
}
static void update_reader_init_acknack_count (const ddsrt_log_cfg_t *logcfg, const struct ephash *guid_hash, const struct nn_guid *rd_guid, nn_count_t count)