diff --git a/desk/app/reel.hoon b/desk/app/reel.hoon index f5ad809a..a51b554e 100644 --- a/desk/app/reel.hoon +++ b/desk/app/reel.hoon @@ -6,6 +6,7 @@ $% state-0 state-1 state-2 + state-3 == :: :: vic: URL of bait service @@ -32,11 +33,18 @@ our-metadata=(map cord metadata:reel) outstanding-pokes=(set (pair ship cord)) == ++$ state-3 + $: %3 + vic=@t + civ=ship + our-metadata=(map cord metadata:reel) + outstanding-pokes=(set (pair ship cord)) + == ++ url-for-token |= [vic=cord our=ship token=cord] (crip "{(trip vic)}{(trip (scot %p our))}/{(trip token)}") -- -=| state-2 +=| state-3 =* state - :: %- agent:dbug @@ -55,12 +63,14 @@ ^- (quip card _this) =/ old !<(versioned-state old-state) ?- -.old - %2 + %3 `this(state old) + %2 + `this(state [%3 vic.old civ.old our-metadata.old ~]) %1 - `this(state [%2 'https://tlon.network/lure/' ~loshut-lonreg ~ ~]) + `this(state [%3 'https://tlon.network/lure/' ~loshut-lonreg ~ ~]) %0 - `this(state [%2 'https://tlon.network/lure/' ~loshut-lonreg ~ ~]) + `this(state [%3 'https://tlon.network/lure/' ~loshut-lonreg ~ ~]) == :: ++ on-poke @@ -130,7 +140,9 @@ =/ group i.t.t.path ?~ (~(has in outstanding-pokes) [target group]) `this :_ this(outstanding-pokes (~(put in outstanding-pokes) [target group])) - ~[[%pass path %agent [target %reel] %poke %reel-want-token-link !>(group)]] + :~ [%pass path %agent [target %reel] %poke %reel-want-token-link !>(group)] + [%pass /expire/(scot %p our.bowl)/[group] %arvo %b [%wait (add ~h1 now.bowl)]] + == == :: ++ on-leave on-leave:def @@ -150,12 +162,24 @@ == :: ++ on-arvo - |= [=wire sign=sign-arvo] + |= [=wire =sign-arvo] ^- (quip card:agent:gall _this) - ?> ?=([%set-ship ~] wire) - ?> ?=([%khan %arow *] sign) - ?: ?=(%.n -.p.sign) - ((slog 'reel: fetch bait ship failed' p.p.sign) `this) - `this + ?+ wire (on-arvo:def wire sign-arvo) + [%set-ship ~] + ?> ?=([%khan %arow *] sign-arvo) + ?: ?=(%.n -.p.sign-arvo) + ((slog 'reel: fetch bait ship failed' p.p.sign-arvo) `this) + `this + :: + [%expire @ @ ~] + ?+ sign-arvo (on-arvo:def wire sign-arvo) + [%behn %wake *] + =/ target (slav %p i.t.wire) + =/ group i.t.t.wire + ?~ error.sign-arvo + `this(outstanding-pokes (~(del in outstanding-pokes) [target group])) + (on-arvo:def wire sign-arvo) + == + == ++ on-fail on-fail:def --