Skip to content

Commit 82e4d1f

Browse files
committed
Do follow-up requests on incomplete type responses
When Cyclone issues a type lookup request for a type T and all its dependencies, it necessarily includes only those dependencies that is aware of. The types learnt from the response may themselves introduce unknown dependencies. That means that wait_for_type_resolved_impl_locked may have to issue follow-up requests. Signed-off-by: Erik Boasson <[email protected]>
1 parent d6906eb commit 82e4d1f

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

src/core/ddsi/src/ddsi_typelib.c

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1355,14 +1355,25 @@ static dds_return_t check_type_resolved_impl_locked (struct ddsi_domaingv *gv, c
13551355
return ret;
13561356
}
13571357

1358-
static dds_return_t wait_for_type_resolved_impl_locked (struct ddsi_domaingv *gv, dds_duration_t timeout, const struct ddsi_type *type, ddsi_type_include_deps_t resolved_kind)
1358+
static dds_return_t wait_for_type_resolved_impl_locked (struct ddsi_domaingv *gv, const ddsi_typeid_t *type_id, dds_duration_t timeout, const struct ddsi_type *type, ddsi_type_include_deps_t resolved_kind, ddsi_type_request_t request)
13591359
{
13601360
const dds_time_t tnow = dds_time ();
13611361
const dds_time_t abstimeout = (DDS_INFINITY - timeout <= tnow) ? DDS_NEVER : (tnow + timeout);
1362-
while (!ddsi_type_resolved_locked (gv, type, resolved_kind))
1362+
bool resolved = ddsi_type_resolved_locked (gv, type, resolved_kind);
1363+
while (!resolved)
13631364
{
13641365
if (!ddsrt_cond_waituntil (&gv->typelib_resolved_cond, &gv->typelib_lock, abstimeout))
13651366
return DDS_RETCODE_TIMEOUT;
1367+
1368+
resolved = ddsi_type_resolved_locked (gv, type, resolved_kind);
1369+
if (request == DDSI_TYPE_SEND_REQUEST && !resolved)
1370+
{
1371+
ddsrt_mutex_unlock (&gv->typelib_lock);
1372+
if (!ddsi_tl_request_type (gv, type_id, NULL, resolved_kind))
1373+
request = DDSI_TYPE_NO_REQUEST;
1374+
ddsrt_mutex_lock (&gv->typelib_lock);
1375+
resolved = ddsi_type_resolved_locked (gv, type, resolved_kind);
1376+
}
13661377
}
13671378
ddsi_type_ref_locked (gv, NULL, type);
13681379
return DDS_RETCODE_OK;
@@ -1389,7 +1400,7 @@ dds_return_t ddsi_wait_for_type_resolved (struct ddsi_domaingv *gv, const ddsi_t
13891400
return DDS_RETCODE_PRECONDITION_NOT_MET;
13901401

13911402
ddsrt_mutex_lock (&gv->typelib_lock);
1392-
ret = wait_for_type_resolved_impl_locked (gv, timeout, *type, resolved_kind);
1403+
ret = wait_for_type_resolved_impl_locked (gv, type_id, timeout, *type, resolved_kind, request);
13931404
ddsrt_mutex_unlock (&gv->typelib_lock);
13941405

13951406
return ret;

0 commit comments

Comments
 (0)