Skip to content

WIP: Remove circular references from DataReaders #134

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion cyclonedds/builtin.py
Original file line number Diff line number Diff line change
@@ -157,7 +157,7 @@ def __init__(self,
),
listener=listener
)
self._next_condition = ReadCondition(self, ViewState.Any | SampleState.NotRead | InstanceState.Any)
self._next_condition_states = ViewState.Any | SampleState.NotRead | InstanceState.Any
if cqos:
_CQos.cqos_destroy(cqos)
self._make_constructors()
12 changes: 4 additions & 8 deletions cyclonedds/sub.py
Original file line number Diff line number Diff line change
@@ -140,8 +140,8 @@ def __init__(
_CQos.cqos_destroy(cqos)
self._topic = topic
self._topic_ref = topic._ref
self._next_condition = None
self._keepalive_entities = [self.subscriber, topic]
self._next_condition_states = ViewState.Any | SampleState.NotRead | InstanceState.Alive
self._keepalive_entities = [self.subscriber]

@property
def topic(self) -> Topic[_T]:
@@ -227,9 +227,7 @@ def read_next(self) -> Optional[_T]:
DDSException
If any error code is returned by the DDS API it is converted into an exception.
"""
self._next_condition = self._next_condition or \
ReadCondition(self, ViewState.Any | SampleState.NotRead | InstanceState.Alive)
samples = self.read(condition=self._next_condition)
samples = self.read(condition=ReadCondition(self, self._next_condition_states))
if samples:
return samples[0]
return None
@@ -242,9 +240,7 @@ def take_next(self) -> Optional[_T]:
DDSException
If any error code is returned by the DDS API it is converted into an exception.
"""
self._next_condition = self._next_condition or \
ReadCondition(self, ViewState.Any | SampleState.NotRead | InstanceState.Alive)
samples = self.take(condition=self._next_condition)
samples = self.take(condition=ReadCondition(self, self._next_condition_states))
if samples:
return samples[0]
return None