fix(transport): recover rover feedback and retained WireGuard routes
This commit is contained in:
@@ -23,16 +23,19 @@ class RoverChannel:
|
||||
# receipts, camera payloads or durable motion state.
|
||||
binding = row["binding"]
|
||||
projection = copy.deepcopy({
|
||||
"name": row.get("name",row["id"]), "id": row["id"], "node_id": row["node_id"], "enrollment": row["enrollment"],
|
||||
"name": row.get("name", row["id"]), "id": row["id"],
|
||||
"node_id": row["node_id"], "enrollment": row["enrollment"],
|
||||
"binding": {key: binding[key] for key in
|
||||
("binding_id", "client_pem", "endpoint_revision") if key in binding},
|
||||
"certificate_previous": row.get("certificate_previous"),
|
||||
"network_paths": row.get("network_paths", {}),
|
||||
})
|
||||
with self.lock:
|
||||
old = self.vehicles.get(row["id"])
|
||||
if old and (old["node_id"] != row["node_id"]
|
||||
or old["binding"]["binding_id"] != binding["binding_id"]
|
||||
or old["binding"].get("endpoint_revision", 0) != binding.get("endpoint_revision", 0)
|
||||
or old["binding"].get("endpoint_revision", 0)
|
||||
!= binding.get("endpoint_revision", 0)
|
||||
or (old["enrollment"] == "paired" and row["enrollment"] != "paired")):
|
||||
self.nodes.pop(old["node_id"], None)
|
||||
self.control.forget(old["node_id"])
|
||||
@@ -40,12 +43,18 @@ class RoverChannel:
|
||||
self.nodes[row["node_id"]] = projection
|
||||
|
||||
def same_generation(self, value):
|
||||
"""Cheap retirement check only; a send still performs full authentication."""
|
||||
"""Retire superseded endpoints; each send still fully authenticates a candidate.
|
||||
|
||||
A higher revision is an in-flight route change. Its feedback must work
|
||||
before the first paced heartbeat can commit that revision.
|
||||
"""
|
||||
with self.lock:
|
||||
row = self.nodes.get(value.get("node_id"))
|
||||
revision = value.get("endpoint_revision", 0)
|
||||
return bool(row and row["enrollment"] == "paired"
|
||||
and row["binding"]["binding_id"] == value.get("binding_id")
|
||||
and row["binding"].get("endpoint_revision", 0) == value.get("endpoint_revision", 0))
|
||||
and type(revision) is int
|
||||
and row["binding"].get("endpoint_revision", 0) <= revision <= 1000000000)
|
||||
|
||||
def operator(self, vehicle, operation, body=None, *, expires_at=None):
|
||||
with self.lock:
|
||||
@@ -89,7 +98,9 @@ class RoverChannel:
|
||||
or not isinstance(relay, str) or len(relay) != 32
|
||||
or any(c not in "0123456789abcdef" for c in relay)):
|
||||
return 400, {"error": "Invalid rover link probe"}
|
||||
return 200, {"connected": True, "sample_clock_v1": True, "diagnostic_lane_v1": True, "budget_interval_v1": True, "rover_details_v1": True,
|
||||
return 200, {"connected": True, "sample_clock_v1": True,
|
||||
"diagnostic_lane_v1": True, "budget_interval_v1": True,
|
||||
"rover_details_v1": True,
|
||||
"control_clock": self.control._clock()}
|
||||
if path == "/v1/node/rover-diagnostics":
|
||||
# Capture this binding's diagnostics object while authority is
|
||||
|
||||
Reference in New Issue
Block a user