Rver cancels subscriptions on correct gall ducts and cancels behn timers correctly as well
:: We maintain a list of subscriptions so if a channel times out, we
:: can cancel all the subscriptions we've made.
::
- subscriptions=(map wire [ship=@p app=term =path])
+ subscriptions=(map wire [ship=@p app=term =path duc=duct])
==
:: channel-request: an action requested on a channel
::
%+ ~(jab by session.channel-state.state) channel-id
|= =channel
=, i.requests
- channel(subscriptions (~(put by subscriptions.channel) channel-wire [ship app path]))
+ channel(subscriptions (~(put by subscriptions.channel) channel-wire [ship app path duct]))
::
$(requests t.requests)
::
=. gall-moves
:_ gall-moves
^- move
- :^ duct %pass channel-wire
+ :^ duc.u.maybe-subscription %pass channel-wire
=, u.maybe-subscription
[%g %deal [our ship] `cush:gall`[app %pull ~]]
::
$(requests t.requests)
::
%delete
- =/ session
- (~(got by session.channel-state.state) channel-id)
+ =/ unitsession
+ (~(get by session.channel-state.state) channel-id)
::
+ ?~ unitsession
+ $(requests t.requests)
+ ::
+ =/ session u.unitsession
=. session.channel-state.state
(~(del by session.channel-state.state) channel-id)
+ ::
=. gall-moves
- %+ weld
- gall-moves
+ %+ weld gall-moves
::
:: produce a list of moves which cancels every gall subscription
::
%+ turn ~(tap by subscriptions.session)
- |= [channel-wire=path ship=@p app=term =path]
+ |= [channel-wire=path ship=@p app=term =path duc=^duct]
+ ^- move
+ ::
+ [duc %pass channel-wire [%g %deal [our ship] app %pull ~]]
+ ::
+ ?: ?=([%& *] state.session)
+ =. gall-moves
+ :_ gall-moves
+ ::
^- move
+ ?> ?=([%& *] state.session)
+ :^ duct.p.state.session %pass /channel/timeout/[channel-id]
+ [%b %rest date.p.state.session]
+ ::
+ $(requests t.requests)
::
- [duct %pass channel-wire [%g %deal [our ship] app %pull ~]]
+ ?> ?=([%| *] state.session)
+ =. duct-to-key.channel-state.state
+ (~(del by duct-to-key.channel-state.state) p.state.session)
::
$(requests t.requests)
::
:: produce a list of moves which cancels every gall subscription
::
%+ turn ~(tap by subscriptions.session)
- |= [channel-wire=path ship=@p app=term =path]
+ |= [channel-wire=path ship=@p app=term =path duc=^duct]
^- move
::
- [duct %pass channel-wire [%g %deal [our ship] app %pull ~]]
+ [duc %pass channel-wire [%g %deal [our ship] app %pull ~]]
--
:: +handle-ford-response: translates a ford response for the outside world
::
