Use separate plist for local process settings
The default participant QoS/plist that is used for defaulting received QoS and for determining which QoS/plist entries to send in discovery data was mixed up with the one that contains local process information such as hostname and process id. It moreover was modified after starting up the protocol stack, and hence after discovery of remote participants. While unlikely, this could lead to an assertion in plist_or_xqos_mergein_missing. Signed-off-by: Erik Boasson <eb@ilities.com>
This commit is contained in:
parent
09e08f7778
commit
5e31a3df90
5 changed files with 25 additions and 21 deletions
|
@ -125,6 +125,25 @@ static dds_return_t dds_domain_init (dds_domain *domain, dds_domainid_t domain_i
|
|||
|
||||
dds__builtin_init (domain);
|
||||
|
||||
/* Set additional default participant properties */
|
||||
|
||||
char progname[50] = "UNKNOWN"; /* FIXME: once retrieving process names is back in */
|
||||
char hostname[64];
|
||||
domain->gv.default_local_plist_pp.process_id = (unsigned) ddsrt_getpid();
|
||||
domain->gv.default_local_plist_pp.present |= PP_PRISMTECH_PROCESS_ID;
|
||||
domain->gv.default_local_plist_pp.exec_name = dds_string_alloc(32);
|
||||
(void) snprintf (domain->gv.default_local_plist_pp.exec_name, 32, "CycloneDDS: %u", domain->gv.default_local_plist_pp.process_id);
|
||||
len = (uint32_t) (13 + strlen (domain->gv.default_local_plist_pp.exec_name));
|
||||
domain->gv.default_local_plist_pp.present |= PP_PRISMTECH_EXEC_NAME;
|
||||
if (ddsrt_gethostname (hostname, sizeof (hostname)) == DDS_RETCODE_OK)
|
||||
{
|
||||
domain->gv.default_local_plist_pp.node_name = dds_string_dup (hostname);
|
||||
domain->gv.default_local_plist_pp.present |= PP_PRISMTECH_NODE_NAME;
|
||||
}
|
||||
domain->gv.default_local_plist_pp.entity_name = dds_alloc (len);
|
||||
(void) snprintf (domain->gv.default_local_plist_pp.entity_name, len, "%s<%u>", progname, domain->gv.default_local_plist_pp.process_id);
|
||||
domain->gv.default_local_plist_pp.present |= PP_ENTITY_NAME;
|
||||
|
||||
if (rtps_start (&domain->gv) < 0)
|
||||
{
|
||||
DDS_LOG (DDS_LC_CONFIG, "Failed to start RTPS\n");
|
||||
|
@ -132,25 +151,6 @@ static dds_return_t dds_domain_init (dds_domain *domain, dds_domainid_t domain_i
|
|||
goto fail_rtps_start;
|
||||
}
|
||||
|
||||
/* Set additional default participant properties */
|
||||
|
||||
char progname[50] = "UNKNOWN"; /* FIXME: once retrieving process names is back in */
|
||||
char hostname[64];
|
||||
domain->gv.default_plist_pp.process_id = (unsigned) ddsrt_getpid();
|
||||
domain->gv.default_plist_pp.present |= PP_PRISMTECH_PROCESS_ID;
|
||||
domain->gv.default_plist_pp.exec_name = dds_string_alloc(32);
|
||||
(void) snprintf (domain->gv.default_plist_pp.exec_name, 32, "CycloneDDS: %u", domain->gv.default_plist_pp.process_id);
|
||||
len = (uint32_t) (13 + strlen (domain->gv.default_plist_pp.exec_name));
|
||||
domain->gv.default_plist_pp.present |= PP_PRISMTECH_EXEC_NAME;
|
||||
if (ddsrt_gethostname (hostname, sizeof (hostname)) == DDS_RETCODE_OK)
|
||||
{
|
||||
domain->gv.default_plist_pp.node_name = dds_string_dup (hostname);
|
||||
domain->gv.default_plist_pp.present |= PP_PRISMTECH_NODE_NAME;
|
||||
}
|
||||
domain->gv.default_plist_pp.entity_name = dds_alloc (len);
|
||||
(void) snprintf (domain->gv.default_plist_pp.entity_name, len, "%s<%u>", progname, domain->gv.default_plist_pp.process_id);
|
||||
domain->gv.default_plist_pp.present |= PP_ENTITY_NAME;
|
||||
|
||||
if (domain->gv.config.liveliness_monitoring)
|
||||
ddsi_threadmon_register_domain (dds_global.threadmon, &domain->gv);
|
||||
return DDS_RETCODE_OK;
|
||||
|
|
|
@ -99,7 +99,7 @@ dds_entity_t dds_create_participant (const dds_domainid_t domain, const dds_qos_
|
|||
new_qos = dds_create_qos ();
|
||||
if (qos != NULL)
|
||||
nn_xqos_mergein_missing (new_qos, qos, DDS_PARTICIPANT_QOS_MASK);
|
||||
nn_xqos_mergein_missing (new_qos, &dom->gv.default_plist_pp.qos, ~(uint64_t)0);
|
||||
nn_xqos_mergein_missing (new_qos, &dom->gv.default_local_plist_pp.qos, ~(uint64_t)0);
|
||||
if ((ret = nn_xqos_valid (&dom->gv.logconfig, new_qos)) < 0)
|
||||
goto err_qos_validation;
|
||||
|
||||
|
|
|
@ -231,6 +231,7 @@ struct q_globals {
|
|||
packets); plus the actual QoSs needed for the builtin
|
||||
endpoints. */
|
||||
nn_plist_t default_plist_pp;
|
||||
nn_plist_t default_local_plist_pp;
|
||||
dds_qos_t default_xqos_rd;
|
||||
dds_qos_t default_xqos_wr;
|
||||
dds_qos_t default_xqos_wr_nad;
|
||||
|
|
|
@ -484,7 +484,7 @@ dds_return_t new_participant_guid (const nn_guid_t *ppguid, struct q_globals *gv
|
|||
pp->lease_duration = gv->config.lease_duration;
|
||||
pp->plist = ddsrt_malloc (sizeof (*pp->plist));
|
||||
nn_plist_copy (pp->plist, plist);
|
||||
nn_plist_mergein_missing (pp->plist, &gv->default_plist_pp, ~(uint64_t)0, ~(uint64_t)0);
|
||||
nn_plist_mergein_missing (pp->plist, &gv->default_local_plist_pp, ~(uint64_t)0, ~(uint64_t)0);
|
||||
|
||||
if (gv->logconfig.c.mask & DDS_LC_DISCOVERY)
|
||||
{
|
||||
|
|
|
@ -1014,6 +1014,7 @@ int rtps_init (struct q_globals *gv)
|
|||
#endif
|
||||
|
||||
nn_plist_init_default_participant (&gv->default_plist_pp);
|
||||
nn_plist_init_default_participant (&gv->default_local_plist_pp);
|
||||
nn_xqos_init_default_reader (&gv->default_xqos_rd);
|
||||
nn_xqos_init_default_writer (&gv->default_xqos_wr);
|
||||
nn_xqos_init_default_writer_noautodispose (&gv->default_xqos_wr_nad);
|
||||
|
@ -1325,6 +1326,7 @@ err_unicast_sockets:
|
|||
nn_xqos_fini (&gv->default_xqos_wr_nad);
|
||||
nn_xqos_fini (&gv->default_xqos_wr);
|
||||
nn_xqos_fini (&gv->default_xqos_rd);
|
||||
nn_plist_fini (&gv->default_local_plist_pp);
|
||||
nn_plist_fini (&gv->default_plist_pp);
|
||||
ddsi_serdatapool_free (gv->serpool);
|
||||
nn_xmsgpool_free (gv->xmsgpool);
|
||||
|
@ -1658,6 +1660,7 @@ void rtps_fini (struct q_globals *gv)
|
|||
nn_xqos_fini (&gv->default_xqos_wr_nad);
|
||||
nn_xqos_fini (&gv->default_xqos_wr);
|
||||
nn_xqos_fini (&gv->default_xqos_rd);
|
||||
nn_plist_fini (&gv->default_local_plist_pp);
|
||||
nn_plist_fini (&gv->default_plist_pp);
|
||||
|
||||
ddsrt_mutex_destroy (&gv->lock);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue