Do send HEARTBEATs if there are new readers

The emphasis is on "do": with this commit it does it even when there is
no data available in the writer.  These were suppressed previously
because of a quirk in the DDSI specification in versions prior to 2.3,
where it impossible for a writer to send a valid heartbeat if its
history cache was empty.

Not sending them has negative consequences, as establishing a reliable
connection then becomes dependent on the reader sending a pre-emptive
ACKNACK message.  Uusally, this makes no observable difference, but if
the writer temporarily disconnects from the reader (but not vice-versa)
it may require the publishing of a sample to resynchronize the two.

Signed-off-by: Erik Boasson <eb@ilities.com>
This commit is contained in:
Erik Boasson 2020-07-01 12:29:23 +02:00 committed by eboasson
parent dff08536c4
commit 5a4193ca37

View file

@ -3462,15 +3462,15 @@ seqno_t writer_max_drop_seq (const struct writer *wr)
int writer_must_have_hb_scheduled (const struct writer *wr, const struct whc_state *whcst) int writer_must_have_hb_scheduled (const struct writer *wr, const struct whc_state *whcst)
{ {
if (ddsrt_avl_is_empty (&wr->readers) || whcst->max_seq < 0) if (ddsrt_avl_is_empty (&wr->readers))
{ {
/* Can't transmit a valid heartbeat if there is no data; and it /* Can't transmit a valid heartbeat if there is no data; and it
wouldn't actually be sent anywhere if there are no readers, so wouldn't actually be sent anywhere if there are no readers, so
there is little point in processing the xevent all the time. there is little point in processing the xevent all the time.
Note that add_msg_to_whc and add_proxy_reader_to_writer will Note that add_msg_to_whc and add_proxy_reader_to_writer will
perform a reschedule. 8.4.2.2.3: need not (can't, really!) send perform a reschedule. Since DDSI 2.3, we can send valid
a heartbeat if no data is available. */ heartbeats in the absence of data. */
return 0; return 0;
} }
else if (!((const struct wr_prd_match *) ddsrt_avl_root_non_empty (&wr_readers_treedef, &wr->readers))->all_have_replied_to_hb) else if (!((const struct wr_prd_match *) ddsrt_avl_root_non_empty (&wr_readers_treedef, &wr->readers))->all_have_replied_to_hb)