From e1088e1e55b2374bb2c3c32d6cb27ad7e1c67897 Mon Sep 17 00:00:00 2001 From: Sidnym Ladrut Date: Mon, 8 Jan 2024 18:52:06 +0000 Subject: [PATCH] patch many minor issues with 'vitals/connection-check.hoon' thread * skip sponsor checks for galaxies (avoids a crash in /app/vitals/hoon) * mark peers unknown to %ames as %dead (avoids a crash in /ax/peers/...) * change thread input from @p to (unit @p) (allow calling from dojo) --- desk/app/vitals.hoon | 4 ++-- desk/ted/vitals/connection-check.hoon | 21 +++++++++++++++------ 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/desk/app/vitals.hoon b/desk/app/vitals.hoon index c536cfb..42ef1f6 100644 --- a/desk/app/vitals.hoon +++ b/desk/app/vitals.hoon @@ -138,7 +138,7 @@ %landscape %vitals-connection-check %noun - !>(ship) + !>((some ship)) == ?: ?=(%pending -.status.u.stat) cor @@ -153,7 +153,7 @@ %landscape %vitals-connection-check %noun - !>(ship) + !>((some ship)) == :: :: public pokes diff --git a/desk/ted/vitals/connection-check.hoon b/desk/ted/vitals/connection-check.hoon index 3705f71..e856cff 100644 --- a/desk/ted/vitals/connection-check.hoon +++ b/desk/ted/vitals/connection-check.hoon @@ -10,7 +10,7 @@ |= arg=vase =/ m (strand ,vase) ^- form:m -=+ !<(target=ship arg) +=+ !<([~ target=ship] arg) ;< our=@p bind:m get-our:io |^ :: early exit; check if we have live path to target @@ -33,7 +33,13 @@ :: set pending to %trying-local ;< ~ bind:m (update-status [%trying-local ~]) :: check if we can contact our own galaxy - ;< gqos=qos:ames bind:m (scry:io qos:ames ~[%gx %vitals %galaxy %vitals-qos]) + ;< gqos=qos:ames + bind:m + =/ mm (strand ,qos:ames) + ^- form:mm + ?: ?=(%czar (clan:title our)) + (pure:mm [%live *@da]) + (scry:io qos:ames ~[%gx %vitals %galaxy %vitals-qos]) ?. ?=(%live -.gqos) (post-result [%no-our-galaxy last-contact.gqos]) :: set pending to %trying-target @@ -104,12 +110,15 @@ ^- update:vitals [target now %pending pending] ++ get-qos - |= =ship + |= peer=ship =/ m (strand ,qos:ames) ^- form:m - ;< state=ship-state:ames - bind:m - (scry:io ship-state:ames ~[%ax %$ %peers (scot %p ship)]) + ;< peers=(map ship ?(%alien %known)) bind:m + (scry:io (map ship ?(%alien %known)) ~[%ax %$ %peers]) + ?. (~(has by peers) peer) + (pure:m [%dead *@da]) + ;< state=ship-state:ames bind:m + (scry:io ship-state:ames ~[%ax %$ %peers (scot %p peer)]) (pure:m (simplify-qos:lib-vitals state)) ++ galaxy-down |= galaxy=ship