diff --git a/desk/app/vitals.hoon b/desk/app/vitals.hoon index c536cfbf..8d164937 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,17 +153,14 @@ %landscape %vitals-connection-check %noun - !>(ship) + !>((some ship)) == :: :: public pokes :: %ship =+ !<(=ship vase) - ?< =(our ship) - ?< =(~ (find ~[our] (saxo:title our now ship))) - ?. ?=([%live *] (scry-qos:lib our now ship)) - !! + ?> ?=([%live *] (scry-qos:lib our now ship)) cor == ++ watch @@ -187,14 +184,12 @@ ?+ path [~ ~] :: [%x %sponsor ~] - ?< ?=(%czar (clan:title our)) %- some %- some :- %vitals-qos !> (scry-qos:lib our now (sein:title our now our)) :: [%x %galaxy ~] - ?< ?=(%czar (clan:title our)) %- some %- some :- %vitals-qos diff --git a/desk/lib/vitals.hoon b/desk/lib/vitals.hoon index d17d2ba9..8e1d916e 100644 --- a/desk/lib/vitals.hoon +++ b/desk/lib/vitals.hoon @@ -11,14 +11,16 @@ ++ scry-qos |= [=ship =time peer=ship] ^- qos:ames - %- simplify-qos - .^ ship-state:ames - %ax - (scot %p ship) - %$ - (scot %da time) - %peers - (scot %p peer) - ~ - == + :: a ship is not guaranteed by %ames to know itself, so we fake it + ?: =(ship peer) + [%live time] + :: .^(* /ax/=//=/peers/[peer]) crashes if the peer is unknown, so we + :: check the source map beforehand and fake an %unborn if we can see + :: a crash coming + =/ ames-peers=path /ax/(scot %p ship)//(scot %da time)/peers + =/ peers .^((map ^ship ?(%alien %known)) ames-peers) + ?. (~(has by peers) peer) + [%unborn time] + =/ pqos .^(ship-state:ames (snoc ames-peers (scot %p peer))) + (simplify-qos pqos) -- diff --git a/desk/ted/vitals/connection-check.hoon b/desk/ted/vitals/connection-check.hoon index 3705f717..7550c644 100644 --- a/desk/ted/vitals/connection-check.hoon +++ b/desk/ted/vitals/connection-check.hoon @@ -10,12 +10,12 @@ |= 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 - ;< now=@da bind:m get-time:io ;< tqos=qos:ames bind:m (get-qos target) + ;< now=@da bind:m get-time:io ?: ?& ?=(%live -.tqos) (gth last-contact.tqos (sub now info-timeout:vitals)) == @@ -103,13 +103,20 @@ !> ^- update:vitals [target now %pending pending] +:: thread version of +scry-qos in /=landscape=/lib/vitals/hoon ++ 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)]) + ;< now=@da bind:m get-time:io + ?: =(our peer) + (pure:m [%live now]) + ;< peers=(map ship ?(%alien %known)) bind:m + (scry:io (map ship ?(%alien %known)) ~[%ax %$ %peers]) + ?. (~(has by peers) peer) + (pure:m [%unborn now]) + ;< 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