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)
This commit is contained in:
Sidnym Ladrut 2024-01-08 18:52:06 +00:00
parent 1088a242e1
commit e1088e1e55
2 changed files with 17 additions and 8 deletions

View File

@ -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

View File

@ -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