mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-11-03 05:51:15 +02:00
fix(marker): restore markers from topology on project load
_create_link_from_topology_data now restores traffic-insight markers (mirroring how filters are restored via update_filters), so markers — including their color — survive project close/reopen and server restart. Guard start_marker's uBridge POST with 'if self._created' (exactly as update_filters guards its update() call): during project load the link is not yet created, so only _markers state is recorded and the marker is applied once via the NIO flow in create()/_ubridge_apply_markers — no double application.
This commit is contained in:
2 files changed
+30
-7
No files matched your search
@@ -355,15 +355,22 @@ class UDPLink(Link):
|
||||
raise ControllerError(f"Invalid BPF expression: {result.get('error', 'unknown error')}")
|
||||
|
||||
marker_side = self._choose_marker_side()
|
||||
data = {"name": name, "bpf": bpf, "tag": tag, "link_id": self._id}
|
||||
await marker_side["node"].post(
|
||||
"/adapters/{adapter_number}/ports/{port_number}/markers/start".format(
|
||||
adapter_number=marker_side["adapter_number"], port_number=marker_side["port_number"]
|
||||
),
|
||||
data=data,
|
||||
)
|
||||
# Record state + runtime capture-side ref unconditionally (so stop/update
|
||||
# work and the marker is persisted), but only push to uBridge when the
|
||||
# link is already live. During project load the link is not yet created
|
||||
# (self._created is False); the marker then rides the NIO via create()
|
||||
# and is applied once by _ubridge_apply_markers — mirroring exactly how
|
||||
# update_filters guards its update() call.
|
||||
self._store_capture_node_for_marker(name, marker_side)
|
||||
self._markers[name].update({"bpf": bpf, "tag": tag, "enabled": True, "color": color})
|
||||
if self._created:
|
||||
data = {"name": name, "bpf": bpf, "tag": tag, "link_id": self._id}
|
||||
await marker_side["node"].post(
|
||||
"/adapters/{adapter_number}/ports/{port_number}/markers/start".format(
|
||||
adapter_number=marker_side["adapter_number"], port_number=marker_side["port_number"]
|
||||
),
|
||||
data=data,
|
||||
)
|
||||
self._project.emit_notification("link.updated", self.asdict())
|
||||
self._project.dump()
|
||||
|
||||
|
||||
Reference in new issue
Block a user