Skip to content

Commit

Permalink
OSPL-12837 DDSI: respond to a retransmit request for a large sample w…
Browse files Browse the repository at this point in the history
…ith just the first fragment
  • Loading branch information
Marcel Jordense committed Sep 23, 2019
1 parent 50a5a96 commit c98e118
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/services/ddsi2e/core/q_config.c
Original file line number Diff line number Diff line change
Expand Up @@ -688,6 +688,9 @@ static const struct cfgelem unsupp_cfgelems[] = {
"<p>Do not use.</p>" },
{ LEAF_W_ATTRS ("RediscoveryBlacklistDuration", rediscovery_blacklist_duration_attrs), 1, "10s", ABSOFF (prune_deleted_ppant.delay), 0, uf_duration_inf, 0, pf_duration,
"<p>This element controls for how long a remote participant that was previously deleted will remain on a blacklist to prevent rediscovery, giving the software on a node time to perform any cleanup actions it needs to do. To some extent this delay is required internally by DDSI2E, but in the default configuration with the 'enforce' attribute set to false, DDSI2E will reallow rediscovery as soon as it has cleared its internal administration. Setting it to too small a value may result in the entry being pruned from the blacklist before DDSI2E is ready, it is therefore recommended to set it to at least several seconds.</p>" },
{ LEAF ("AlwaysRetransmitCompleteSample"), 1, "false", ABSOFF (retransmit_complete_sample), 0, uf_boolean, 0, pf_boolean,
"<p>This element controls if a sample is retransitted completely or only missing fragments.</p>"
},
{ MGROUP ("ControlTopic", control_topic_cfgelems, control_topic_cfgattrs), 1, 0, 0, 0, 0, 0, 0, 0,
"<p>The ControlTopic element allows configured whether DDSI2E provides a special control interface via a predefined topic or not.<p>" },
{ GROUP ("Test", unsupp_test_cfgelems),
Expand Down
1 change: 1 addition & 0 deletions src/services/ddsi2e/core/q_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,7 @@ struct config
int unicast_response_to_spdp_messages;
int synchronous_delivery_priority_threshold;
os_int64 synchronous_delivery_latency_bound;
int retransmit_complete_sample;

/* Write cache */

Expand Down
12 changes: 11 additions & 1 deletion src/services/ddsi2e/core/q_transmit.c
Original file line number Diff line number Diff line change
Expand Up @@ -715,6 +715,7 @@ int enqueue_sample_wrlock_held (struct writer *wr, os_int64 seq, const struct nn
{
unsigned i, sz, nfrags;
int enqueued = 1;
int ret_on_success = 0;

ASSERT_MUTEX_HELD (&wr->e.lock);

Expand All @@ -725,6 +726,15 @@ int enqueue_sample_wrlock_held (struct writer *wr, os_int64 seq, const struct nn
/* end-of-transaction messages are empty, but still need to be sent */
nfrags = 1;
}
else if (nfrags > 1 && !isnew && !config.retransmit_complete_sample)
{
/* retransmit only a single fragment for a retransmit request of a
full sample, so that afterward it switches to NACKFRAG mode -
should do so only do for implementations with known behaviours */
nfrags = 1;
/* return -1 to prevent the retransmit loop from resending more samples */
ret_on_success = -1;
}
for (i = 0; i < nfrags && enqueued; i++)
{
struct nn_xmsg *fmsg = NULL;
Expand Down Expand Up @@ -762,7 +772,7 @@ int enqueue_sample_wrlock_held (struct writer *wr, os_int64 seq, const struct nn
}
}
}
return enqueued ? 0 : -1;
return enqueued ? ret_on_success : -1;
}

static int insert_sample_in_whc (struct writer *wr, os_int64 seq, struct nn_plist *plist, serdata_t serdata)
Expand Down

0 comments on commit c98e118

Please sign in to comment.