Skip to content
Open
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,9 @@ def register_input(
port_id.id = 0
if port_id.internal is None:
port_id.internal = False
if channel_id in self._channels:
old_port_id = self._channels[channel_id].port_id
self._ports[old_port_id].get_channels().discard(channel_id)
channel = Channel()
channel.set_port_id(port_id)
self._channels[channel_id] = channel
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ class TestChannelRegistration:
def manager(self):
return InputManager(worker_id=WORKER_ID, input_queue=MagicMock())

def test_re_registering_channel_leaves_stale_reverse_mapping(self, manager):
def test_re_registering_channel_moves_reverse_mapping(self, manager):
port_a, port_b = PortIdentity(0, False), PortIdentity(1, False)
channel_id = _channel("upstream")
for port_id in (port_a, port_b):
Expand All @@ -115,12 +115,9 @@ def test_re_registering_channel_leaves_stale_reverse_mapping(self, manager):
manager.register_input(channel_id, port_a)
manager.register_input(channel_id, port_b)

# The forward mapping is updated to the new port ...
assert manager.get_port_id(channel_id) == port_b
assert channel_id in manager.get_port(port_b).get_channels()
# ... but the old port's channel set is never cleaned up, so the
# channel remains in both reverse mappings (current behavior).
assert channel_id in manager.get_port(port_a).get_channels()
assert channel_id not in manager.get_port(port_a).get_channels()

def test_data_channel_ids_exclude_control_channels(self, manager):
port_id = PortIdentity(0, False)
Expand Down
Loading