Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do follow-up requests on incomplete type responses #1666

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 19 additions & 3 deletions src/core/ddsi/src/ddsi_typelib.c
Original file line number Diff line number Diff line change
Expand Up @@ -1539,14 +1539,30 @@ static dds_return_t check_type_resolved_impl_locked (struct ddsi_domaingv *gv, c
return ret;
}

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)
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)
{
#ifndef DDS_HAS_TYPE_DISCOVERY
(void)type_id;
(void)request;
#endif
const dds_time_t tnow = dds_time ();
const dds_time_t abstimeout = (DDS_INFINITY - timeout <= tnow) ? DDS_NEVER : (tnow + timeout);
while (!ddsi_type_resolved_locked (gv, type, resolved_kind))
bool resolved = ddsi_type_resolved_locked (gv, type, resolved_kind);
while (!resolved)
{
if (!ddsrt_cond_waituntil (&gv->typelib_resolved_cond, &gv->typelib_lock, abstimeout))
return DDS_RETCODE_TIMEOUT;
resolved = ddsi_type_resolved_locked (gv, type, resolved_kind);
#ifdef DDS_HAS_TYPE_DISCOVERY
if (request == DDSI_TYPE_SEND_REQUEST && !resolved)
{
ddsrt_mutex_unlock (&gv->typelib_lock);
if (!ddsi_tl_request_type (gv, type_id, NULL, resolved_kind))
request = DDSI_TYPE_NO_REQUEST;
ddsrt_mutex_lock (&gv->typelib_lock);
resolved = ddsi_type_resolved_locked (gv, type, resolved_kind);
}
#endif
}
ddsi_type_ref_locked (gv, NULL, type);
return DDS_RETCODE_OK;
Expand Down Expand Up @@ -1578,7 +1594,7 @@ dds_return_t ddsi_wait_for_type_resolved (struct ddsi_domaingv *gv, const ddsi_t
#endif

ddsrt_mutex_lock (&gv->typelib_lock);
ret = wait_for_type_resolved_impl_locked (gv, timeout, *type, resolved_kind);
ret = wait_for_type_resolved_impl_locked (gv, type_id, timeout, *type, resolved_kind, request);
ddsrt_mutex_unlock (&gv->typelib_lock);

return ret;
Expand Down
Loading