Skip to content

Commit bcae182

Browse files
committed
WiP: repeat requests for types until deps resolved
1 parent 4c510fd commit bcae182

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

src/core/ddsi/src/ddsi_typelib.c

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1539,14 +1539,30 @@ static dds_return_t check_type_resolved_impl_locked (struct ddsi_domaingv *gv, c
15391539
return ret;
15401540
}
15411541

1542-
static dds_return_t wait_for_type_resolved_impl_locked (struct ddsi_domaingv *gv, dds_duration_t timeout, const struct ddsi_type *type, enum ddsi_type_include_deps resolved_kind)
1542+
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, enum ddsi_type_include_deps resolved_kind, ddsi_type_request_t request)
15431543
{
1544+
#ifndef DDS_HAS_TYPE_DISCOVERY
1545+
(void)type_id;
1546+
(void)request;
1547+
#endif
15441548
const dds_time_t tnow = dds_time ();
15451549
const dds_time_t abstimeout = (DDS_INFINITY - timeout <= tnow) ? DDS_NEVER : (tnow + timeout);
1546-
while (!ddsi_type_resolved_locked (gv, type, resolved_kind))
1550+
bool resolved = ddsi_type_resolved_locked (gv, type, resolved_kind);
1551+
while (!resolved)
15471552
{
15481553
if (!ddsrt_cond_waituntil (&gv->typelib_resolved_cond, &gv->typelib_lock, abstimeout))
15491554
return DDS_RETCODE_TIMEOUT;
1555+
resolved = ddsi_type_resolved_locked (gv, type, resolved_kind);
1556+
#ifdef DDS_HAS_TYPE_DISCOVERY
1557+
if (request == DDSI_TYPE_SEND_REQUEST && !resolved)
1558+
{
1559+
ddsrt_mutex_unlock (&gv->typelib_lock);
1560+
if (!ddsi_tl_request_type (gv, type_id, NULL, resolved_kind))
1561+
request = DDSI_TYPE_NO_REQUEST;
1562+
ddsrt_mutex_lock (&gv->typelib_lock);
1563+
resolved = ddsi_type_resolved_locked (gv, type, resolved_kind);
1564+
}
1565+
#endif
15501566
}
15511567
ddsi_type_ref_locked (gv, NULL, type);
15521568
return DDS_RETCODE_OK;
@@ -1578,7 +1594,7 @@ dds_return_t ddsi_wait_for_type_resolved (struct ddsi_domaingv *gv, const ddsi_t
15781594
#endif
15791595

15801596
ddsrt_mutex_lock (&gv->typelib_lock);
1581-
ret = wait_for_type_resolved_impl_locked (gv, timeout, *type, resolved_kind);
1597+
ret = wait_for_type_resolved_impl_locked (gv, type_id, timeout, *type, resolved_kind, request);
15821598
ddsrt_mutex_unlock (&gv->typelib_lock);
15831599

15841600
return ret;

0 commit comments

Comments
 (0)