mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-10-12 21:45:41 +03:00
Node._list_ports() rebuilds every Port object, and it runs on each node update — including every compute node.updated notification (a node reporting started is one). The links are unaffected by that rebuild, but the fresh port objects started out with link=None, so after any node update the "Port is already used" guard in Link.add_node stopped matching: a second link on an occupied port reached the compute, where the port's NIO was replaced before the attach failed on the already-bound anchor, leaving the link half-torn-down (on IOU, deleting the project afterwards left the node's anchor TAPs and a per-link bridge on the host). Carry the link back-references over by (adapter_number, port_number), first match wins, mirroring get_port; a port that still exists keeps its link. Regression tests pin both the reference (test_node) and the guard (test_link: the duplicate link is refused after a node update).