From 5a4193ca37ece13c4a0d80e2d4ce3cf19df0bbde Mon Sep 17 00:00:00 2001 From: Erik Boasson Date: Wed, 1 Jul 2020 12:29:23 +0200 Subject: [PATCH] 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 --- src/core/ddsi/src/q_entity.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/core/ddsi/src/q_entity.c b/src/core/ddsi/src/q_entity.c index 3035b64..8443ef0 100644 --- a/src/core/ddsi/src/q_entity.c +++ b/src/core/ddsi/src/q_entity.c @@ -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) { - 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 wouldn't actually be sent anywhere if there are no readers, so there is little point in processing the xevent all the time. 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 - a heartbeat if no data is available. */ + perform a reschedule. Since DDSI 2.3, we can send valid + heartbeats in the absence of data. */ return 0; } else if (!((const struct wr_prd_match *) ddsrt_avl_root_non_empty (&wr_readers_treedef, &wr->readers))->all_have_replied_to_hb)