Skip to content

Commit

Permalink
Check retcode from wait() in take_next_sample impl
Browse files Browse the repository at this point in the history
Brought up in #10
  • Loading branch information
iguessthislldo committed Feb 21, 2020
1 parent c6d4b83 commit c64c286
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions pyopendds/dev/include/pyopendds/user.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -183,14 +183,15 @@ class TopicType : public TopicTypeBase {
"Could not narrow reader implementation", Errors::PyOpenDDS_Error());
}

DDS::ReturnCode_t rc;
DDS::ReadCondition_var read_condition = reader_impl->create_readcondition(
DDS::ANY_SAMPLE_STATE, DDS::ANY_VIEW_STATE, DDS::ANY_SAMPLE_STATE);
DDS::WaitSet_var ws = new DDS::WaitSet;
ws->attach_condition(read_condition);
DDS::ConditionSeq active;
const DDS::Duration_t max_wait_time = {10, 0};
rc = ws->wait(active, max_wait_time);
if (Errors::check_rc(ws->wait(active, max_wait_time))) {
throw Exception();
}
ws->detach_condition(read_condition);
reader_impl->delete_readcondition(read_condition);

Expand All @@ -199,8 +200,10 @@ class TopicType : public TopicTypeBase {
if (Errors::check_rc(reader_impl->take_next_sample(sample, info))) {
throw Exception();
}

PyObject* rv = nullptr;
Type<IdlType>::cpp_to_python(sample, rv);

return rv;
}

Expand Down

0 comments on commit c64c286

Please sign in to comment.