From 087f24e9316981c4e605f9c18ab90838c0015f01 Mon Sep 17 00:00:00 2001 From: yosoyubik Date: Fri, 22 Apr 2022 10:06:53 +0200 Subject: [PATCH] ames: use +trace to print logs --- pkg/arvo/sys/vane/ames.hoon | 40 ++++++++++++++----------------- pkg/arvo/tests/sys/vane/ames.hoon | 12 ++++------ 2 files changed, 22 insertions(+), 30 deletions(-) diff --git a/pkg/arvo/sys/vane/ames.hoon b/pkg/arvo/sys/vane/ames.hoon index df26c329e3..8533b7262e 100644 --- a/pkg/arvo/sys/vane/ames.hoon +++ b/pkg/arvo/sys/vane/ames.hoon @@ -1220,8 +1220,8 @@ ?~ parsed=(parse-bone-wire wire) :: no-op :: - =/ =tape "ames dropping malformed wire: {(spud wire)}" - (emit duct %pass /malformed-wire %d %flog %text tape) + ~> %slog.0^leaf/"ames: dropping malformed wire: {(spud wire)}" + event-core ?> ?=([@ her=ship *] u.parsed) =* her her.u.parsed =/ =peer-state (got-peer-state her) @@ -1233,20 +1233,19 @@ == :: ignore events from an old rift :: - ?. odd.veb event-core - (log "ames dropping old rift wire: {(spud wire)}") + %- %^ trace odd.veb her + |.("dropping old rift wire: {(spud wire)}") + event-core =/ =bone ?-(u.parsed [%new *] bone.u.parsed, [%old *] bone.u.parsed) - =? event-core.peer-core &(odd.veb ?=([%old *] u.parsed)) - (log "ames parsing old wire format: {(spud wire)}") + =? peer-core ?=([%old *] u.parsed) + %- %^ trace odd.veb her + |.("parsing old wire: {(spud wire)}") + peer-core ?~ error (send-ack bone) (send-nack bone u.error) :: - ++ log - |= =tape - ^+ event-core - (emit duct %pass /on-take-done-parse-wire %d %flog %text tape) :: if processing succeded, send positive ack packet and exit :: ++ send-ack @@ -1525,9 +1524,9 @@ ++ on-take-boon |= [=wire payload=*] ^+ event-core - |^ ?~ parsed=(parse-bone-wire wire) - (log "ames dropping malformed wire: {(spud wire)}") + ~> %slog.0^leaf/"ames: dropping malformed wire: {(spud wire)}" + event-core :: ?> ?=([@ her=ship *] u.parsed) =* her her.u.parsed @@ -1540,19 +1539,16 @@ == :: ignore events from an old rift :: - ?. odd.veb event-core - (log "ames dropping old rift wire: {(spud wire)}") + %- %^ trace odd.veb her + |.("dropping old rift wire: {(spud wire)}") + event-core =/ =bone ?-(u.parsed [%new *] bone.u.parsed, [%old *] bone.u.parsed) - =? event-core.peer-core &(odd.veb ?=([%old *] u.parsed)) - (log "ames parsing old wire: {(spud wire)}") + =? peer-core ?=([%old *] u.parsed) + %- %^ trace odd.veb her + |.("parsing old wire: {(spud wire)}") + peer-core abet:(on-memo:peer-core bone payload %boon) - :: - ++ log - |= =tape - ^+ event-core - (emit duct %pass /on-take-boon-parse-wire %d %flog %text tape) - -- :: +on-plea: handle request to send message :: ++ on-plea diff --git a/pkg/arvo/tests/sys/vane/ames.hoon b/pkg/arvo/tests/sys/vane/ames.hoon index 078d9adc02..ce02231700 100644 --- a/pkg/arvo/tests/sys/vane/ames.hoon +++ b/pkg/arvo/tests/sys/vane/ames.hoon @@ -341,9 +341,8 @@ =^ moves2 bud (call bud ~[//unix] %hear (snag-packet 0 moves1)) =^ moves3 bud (take bud /bone/~nec/1 ~[//unix] %g %done ~) %+ expect-eq - !> :^ ~[//unix] %pass /on-take-done-parse-wire - [%d %flog %text "ames parsing old wire format: /bone/~nec/1"] - !> (snag 0 `(list move:ames)`moves3) + !> 1 + !> (lent `(list move:ames)`moves3) :: ++ test-dangling-bone ^- tang =^ moves0 bud (call bud ~[/g/hood] %spew [%odd]~) @@ -359,15 +358,12 @@ ^- sign:ames [%jael %public-keys %diff who=~nec %rift from=0 to=1] :: %gall has a pending wire with the old rift, so sending a gift to - :: %ames on it will drop that request, and print a message to the user + :: %ames on it will drop that request, not producing any moves :: =^ moves3 bud (take bud /bone/~nec/0/1 ~[//unix] %g %done ~) :: %+ expect-eq - !> %- sy - :_ ~ - :^ ~[//unix] %pass /on-take-done-parse-wire - [%d %flog %text "ames dropping old rift wire: /bone/~nec/0/1"] + !> ~ !> (sy ,.moves3) :: ++ test-ames-flow-with-new-rift ^- tang