Represent fragment size as uint16_t
Signed-off-by: Erik Boasson <eb@ilities.com>
This commit is contained in:
parent
7fbbc13e65
commit
82e6a7972c
6 changed files with 32 additions and 13 deletions
|
@ -167,9 +167,9 @@ static struct cfgelem general_cfgelems[] = {
|
|||
"it is generally advisable to also consider reducing "
|
||||
"Internal/FragmentSize.</p>"),
|
||||
UNIT("memsize")),
|
||||
STRING("FragmentSize", NULL, 1, "1280 B",
|
||||
STRING("FragmentSize", NULL, 1, "1344 B",
|
||||
MEMBER(fragment_size),
|
||||
FUNCTIONS(0, uf_memsize, 0, pf_memsize),
|
||||
FUNCTIONS(0, uf_memsize16, 0, pf_memsize16),
|
||||
DESCRIPTION(
|
||||
"<p>This element specifies the size of DDSI sample fragments generated "
|
||||
"by Cyclone DDS. Samples larger than FragmentSize are fragmented into "
|
||||
|
|
|
@ -262,8 +262,8 @@ struct config
|
|||
|
||||
unsigned delivery_queue_maxsamples;
|
||||
|
||||
uint16_t fragment_size;
|
||||
uint32_t max_msg_size;
|
||||
uint32_t fragment_size;
|
||||
|
||||
int publish_uc_locators; /* Publish discovery unicast locators */
|
||||
int enable_uc_locators; /* If false, don't even try to create a unicast socket */
|
||||
|
|
|
@ -164,6 +164,7 @@ DU(natint_255);
|
|||
DUPF(participantIndex);
|
||||
DU(dyn_port);
|
||||
DUPF(memsize);
|
||||
DUPF(memsize16);
|
||||
DU(duration_inf);
|
||||
DU(duration_ms_1hr);
|
||||
DU(duration_ms_1s);
|
||||
|
@ -1092,8 +1093,26 @@ static enum update_result uf_memsize (struct cfgst *cfgst, void *parent, struct
|
|||
|
||||
static void pf_memsize (struct cfgst *cfgst, void *parent, struct cfgelem const * const cfgelem, uint32_t sources)
|
||||
{
|
||||
int const * const elem = cfg_address (cfgst, parent, cfgelem);
|
||||
pf_int64_unit (cfgst, *elem, sources, unittab_memsize, "B");
|
||||
uint32_t const * const elem = cfg_address (cfgst, parent, cfgelem);
|
||||
pf_int64_unit (cfgst, (int64_t) *elem, sources, unittab_memsize, "B");
|
||||
}
|
||||
|
||||
static enum update_result uf_memsize16 (struct cfgst *cfgst, void *parent, struct cfgelem const * const cfgelem, UNUSED_ARG (int first), const char *value)
|
||||
{
|
||||
int64_t size = 0;
|
||||
if (uf_natint64_unit (cfgst, &size, value, unittab_memsize, 1, 0, UINT16_MAX) != URES_SUCCESS)
|
||||
return URES_ERROR;
|
||||
else {
|
||||
uint16_t * const elem = cfg_address (cfgst, parent, cfgelem);
|
||||
*elem = (uint16_t) size;
|
||||
return URES_SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
static void pf_memsize16 (struct cfgst *cfgst, void *parent, struct cfgelem const * const cfgelem, uint32_t sources)
|
||||
{
|
||||
uint16_t const * const elem = cfg_address (cfgst, parent, cfgelem);
|
||||
pf_int64_unit (cfgst, (int64_t) *elem, sources, unittab_memsize, "B");
|
||||
}
|
||||
|
||||
static enum update_result uf_tracingOutputFileName (struct cfgst *cfgst, UNUSED_ARG (void *parent), UNUSED_ARG (struct cfgelem const * const cfgelem), UNUSED_ARG (int first), const char *value)
|
||||
|
|
|
@ -541,7 +541,7 @@ dds_return_t create_fragment_message (struct writer *wr, seqno_t seq, const stru
|
|||
|
||||
ASSERT_MUTEX_HELD (&wr->e.lock);
|
||||
|
||||
if (fragnum * gv->config.fragment_size >= size && size > 0)
|
||||
if (fragnum * (uint32_t) gv->config.fragment_size >= size && size > 0)
|
||||
{
|
||||
/* This is the first chance to detect an attempt at retransmitting
|
||||
an non-existent fragment, which a malicious (or buggy) remote
|
||||
|
@ -617,20 +617,20 @@ dds_return_t create_fragment_message (struct writer *wr, seqno_t seq, const stru
|
|||
|
||||
frag->fragmentStartingNum = fragnum + 1;
|
||||
frag->fragmentsInSubmessage = 1;
|
||||
frag->fragmentSize = (unsigned short) gv->config.fragment_size;
|
||||
frag->sampleSize = (uint32_t)size;
|
||||
|
||||
fragstart = fragnum * gv->config.fragment_size;
|
||||
#if MULTIPLE_FRAGS_IN_SUBMSG /* ugly hack for testing only */
|
||||
if (fragstart + gv->config.fragment_size < ddsi_serdata_size (serdata) &&
|
||||
fragstart + 2 * gv->config.fragment_size >= ddsi_serdata_size (serdata))
|
||||
frag->fragmentsInSubmessage++;
|
||||
ret = frag->fragmentsInSubmessage;
|
||||
#endif
|
||||
frag->fragmentSize = gv->config.fragment_size;
|
||||
frag->sampleSize = (uint32_t) size;
|
||||
|
||||
fraglen = gv->config.fragment_size * frag->fragmentsInSubmessage;
|
||||
fragstart = fragnum * (uint32_t) gv->config.fragment_size;
|
||||
fraglen = (uint32_t) gv->config.fragment_size * (uint32_t) frag->fragmentsInSubmessage;
|
||||
if (fragstart + fraglen > size)
|
||||
fraglen = (uint32_t)(size - fragstart);
|
||||
fraglen = (uint32_t) (size - fragstart);
|
||||
ddcmn->octetsToInlineQos = (unsigned short) ((char*) (frag+1) - ((char*) &ddcmn->octetsToInlineQos + 2));
|
||||
|
||||
if (wr->reliable && (!isnew || fragstart + fraglen == ddsi_serdata_size (serdata)))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue