fix(marker): stop auto-deleting markers on node stop in node_updated

Markers are persistent link-scoped features (like packet filters), not
transient runtime features (like capture).  Tearing them down on every
node stop breaks stop/start restore: the NIO-based re-application in
_ubridge_apply_markers works correctly on restart, but node_updated
was prematurely calling stop_marker which erased _markers state and
dumped an empty topology.

Now markers survive node stop transparently — the ubridge filter dies
with the process but is re-added from nio.markers in
add_ubridge_udp_connection when the node starts again, mirroring
exactly how packet filters behave.
This commit is contained in:
YueGuobin 2026-07-12 14:43:06 +08:00
parent 7c90fa9e64
commit 239f42f5aa
No known key found for this signature in database

View File

@ -321,10 +321,11 @@ class UDPLink(Link):
"""
if self._capture_node and node == self._capture_node["node"] and node.status != "started":
await self.stop_capture()
# Tear down any marker whose capture-side node just stopped.
for name, marker_info in list(self._markers.items()):
if marker_info.get("capture_node_id") == node.id and node.status != "started":
await self.stop_marker(name)
# Marker clean-up is *not* done on node stop — markers are a persistent
# link-scoped feature that recovers via NIO on restart (see
# _ubridge_apply_markers in add_ubridge_udp_connection). The user
# explicitly deletes a marker via the REST API, and a marker is torn
# down automatically only when its link is deleted.
def _capture_node_for_marker(self, name):
"""Return the stored (node, adapter_number, port_number) for a marker's capture side."""