mirror of
https://github.com/urbit/shrub.git
synced 2024-12-19 08:32:39 +03:00
Merge pull request #6796 from urbit/develop
Merge develop into next/kelvin/411
This commit is contained in:
commit
c846dea16b
@ -45,7 +45,6 @@
|
||||
|= [=mark =vase]
|
||||
^- (quip card _this)
|
||||
|^
|
||||
?> (team:title our.bowl src.bowl)
|
||||
?+ mark (on-poke:def mark vase)
|
||||
%handle-http-request
|
||||
=+ !<([id=@ta req=inbound-request:eyre] vase)
|
||||
@ -53,6 +52,7 @@
|
||||
(handle-http-request id req)
|
||||
::
|
||||
%azimuth-action
|
||||
?> (team:title our.bowl src.bowl)
|
||||
=+ !<([%disconnect bind=binding:eyre] vase)
|
||||
~& >>> "disconnecting at {<bind>}"
|
||||
:_ this
|
||||
|
@ -787,7 +787,7 @@
|
||||
:: %snub: set packet blocklist to .ships
|
||||
:: %spew: set verbosity toggles
|
||||
:: %cong: adjust congestion control parameters
|
||||
:: %stir: recover from timer desync
|
||||
:: %stir: recover from timer desync and assorted debug commands
|
||||
:: %trim: release memory
|
||||
:: %vega: kernel reload notification
|
||||
::
|
||||
|
@ -556,7 +556,7 @@
|
||||
:: bug: debug printing configuration
|
||||
:: snub: blocklist for incoming packets
|
||||
:: cong: parameters for marking a flow as clogged
|
||||
:: dead: dead flow consolidation timer, if set
|
||||
:: dead: dead flow consolidation timer and recork timer, if set
|
||||
::
|
||||
+$ ames-state
|
||||
$+ ames-state
|
||||
@ -1786,8 +1786,6 @@
|
||||
=^ moz u.cached-state
|
||||
?. ?=(%16 -.u.cached-state) [~ u.cached-state]
|
||||
:_ 17+(state-16-to-17:load:adult-core +.u.cached-state)
|
||||
~> %slog.0^leaf/"ames: init dead flow consolidation timer"
|
||||
:- [[/ames]~ %pass /dead-flow %b %wait `@da`(add now ~m2)]
|
||||
?^ moz moz :: if we have just added the timer in state-7-to-8, skip
|
||||
=; recork-timer=(list [@da duct])
|
||||
?^ recork-timer ~
|
||||
@ -2009,15 +2007,44 @@
|
||||
event-core
|
||||
:: +on-stir: recover from timer desync, setting new timers as needed
|
||||
::
|
||||
:: .arg is unused, meant to ease future debug commands
|
||||
:: .arg can be %rift or %dead
|
||||
::
|
||||
++ on-stir
|
||||
|= arg=@t
|
||||
^+ event-core
|
||||
|^ ?+ arg do-stir
|
||||
%rift do-rift
|
||||
%dead do-dead
|
||||
==
|
||||
::
|
||||
++ do-dead
|
||||
=/ ded=(unit dead-timer) +.flow.dead.ames-state
|
||||
?^ ded
|
||||
%- (slog leaf+"ames: turning off dead flow consolidation" ~)
|
||||
=. event-core
|
||||
(emit:event-core duct.u.ded %pass wire.u.ded %b %rest date.u.ded)
|
||||
(wake-dead-flows:event-core %.n ~)
|
||||
::
|
||||
%- (slog leaf+"ames: switching to dead flow consolidation" ~)
|
||||
=; cor=event-core
|
||||
(wake-dead-flows:cor %.y ~)
|
||||
%- ~(rep by peers.ames-state:event-core)
|
||||
|= [[=ship =ship-state] core=_event-core]
|
||||
^+ event-core
|
||||
=/ peer-state=(unit peer-state) (get-peer-state:core ship)
|
||||
?~ peer-state core
|
||||
%- ~(rep by snd.u.peer-state)
|
||||
|= [[=bone =message-pump-state] cor=_core]
|
||||
^+ event-core
|
||||
=/ next-wake next-wake.packet-pump-state.message-pump-state
|
||||
?. ?& =(~m2 rto.metrics.packet-pump-state.message-pump-state)
|
||||
?=(^ next-wake)
|
||||
==
|
||||
cor
|
||||
=/ peer-core (abed-peer:pe:cor ship u.peer-state)
|
||||
=/ message-pump (abed:mu:peer-core bone)
|
||||
abet:(pu-emit:packet-pump:message-pump %b %rest u.next-wake)
|
||||
::
|
||||
++ do-rift
|
||||
=/ =rift
|
||||
=- ~|(%no-rift (,@ q.q:(need (need -))))
|
||||
@ -2433,6 +2460,35 @@
|
||||
++ cork-bone |=(=bone abet:(on-cork-flow:peer-core bone))
|
||||
++ kill-bone |=(=bone abet:(on-kill-flow:peer-core bone))
|
||||
--
|
||||
:: +wake-dead-flow: call on-wake on all dead flows, optionally setting new
|
||||
:: dead flow timer
|
||||
::
|
||||
++ wake-dead-flows
|
||||
|= [set-new-timer=? error=(unit tang)]
|
||||
^+ event-core
|
||||
=. flow.dead.ames-state.event-core
|
||||
?. set-new-timer
|
||||
flow/~
|
||||
flow/`[~[/ames] /dead-flow `@da`(add now ~m2)]
|
||||
=. event-core
|
||||
?. set-new-timer
|
||||
event-core
|
||||
(emit:event-core ~[/ames] %pass /dead-flow %b %wait `@da`(add now ~m2))
|
||||
%- ~(rep by peers.ames-state:event-core)
|
||||
|= [[=ship =ship-state] core=_event-core]
|
||||
^+ event-core
|
||||
=/ peer-state=(unit peer-state) (get-peer-state:core ship)
|
||||
?~ peer-state core
|
||||
=/ peer-core (abed-peer:pe:core ship u.peer-state)
|
||||
=< abet
|
||||
^+ peer-core
|
||||
%- ~(rep by snd.u.peer-state)
|
||||
|= [[=bone =message-pump-state] cor=_peer-core]
|
||||
?. ?& =(~m2 rto.metrics.packet-pump-state.message-pump-state)
|
||||
?=(^ next-wake.packet-pump-state.message-pump-state)
|
||||
==
|
||||
cor
|
||||
(on-wake:cor bone error)
|
||||
:: +on-take-wake: receive wakeup or error notification from behn
|
||||
::
|
||||
++ on-take-wake
|
||||
@ -2453,22 +2509,7 @@
|
||||
(request-attestation u.ship)
|
||||
::
|
||||
?: ?=([%dead-flow ~] wire)
|
||||
=; cor=event-core
|
||||
=. flow.dead.ames-state.cor
|
||||
flow/`[~[/ames] /dead-flow `@da`(add now ~m2)]
|
||||
(emit:cor duct %pass /dead-flow %b %wait `@da`(add now ~m2))
|
||||
%- ~(rep by peers.ames-state)
|
||||
|= [[=ship =ship-state] core=_event-core]
|
||||
^+ event-core
|
||||
=/ peer-state=(unit peer-state) (get-peer-state:core ship)
|
||||
?~ peer-state core
|
||||
%- ~(rep by snd.u.peer-state)
|
||||
|= [[=bone =message-pump-state] cor=_core]
|
||||
?. ?& =(~m2 rto.metrics.packet-pump-state.message-pump-state)
|
||||
?=(^ next-wake.packet-pump-state.message-pump-state)
|
||||
==
|
||||
cor
|
||||
abet:(on-wake:(abed-peer:pe:cor ship u.peer-state) bone error)
|
||||
(wake-dead-flows %.y error)
|
||||
::
|
||||
?. ?=([%recork ~] wire)
|
||||
=/ res=(unit ?([%fine her=ship =^wire] [%pump her=ship =bone]))
|
||||
@ -2837,17 +2878,15 @@
|
||||
::
|
||||
=* duct unix-duct.ames-state
|
||||
::
|
||||
=^ dead-moves dead.ames-state
|
||||
?. ?=([~ ~] [+.flow +.cork]:dead.ames-state)
|
||||
`dead.ames-state
|
||||
:- :- [~[/ames] %pass /dead-flow %b %wait `@da`(add now ~m2)]
|
||||
[~[/ames] %pass /recork %b %wait `@da`(add now ~d1)]~
|
||||
:- flow/`[~[/ames] /dead-flow `@da`(add now ~m2)]
|
||||
=^ cork-moves cork.dead.ames-state
|
||||
?. ?=(~ +.cork.dead.ames-state)
|
||||
`cork.dead.ames-state
|
||||
:- [~[/ames] %pass /recork %b %wait `@da`(add now ~d1)]~
|
||||
cork/`[~[/ames] /recork `@da`(add now ~d1)]
|
||||
::
|
||||
%- emil
|
||||
%+ weld
|
||||
dead-moves
|
||||
cork-moves
|
||||
^- (list move)
|
||||
:~ [duct %give %turf turfs]
|
||||
[duct %pass /ping %g %deal [our our /ames] %ping %poke %noun !>(%kick)]
|
||||
@ -4071,7 +4110,7 @@
|
||||
:: and we don't want to consolidate that
|
||||
::
|
||||
=? peer-core ?=(^ new-wake)
|
||||
?: =(~m2 rto.metrics.state)
|
||||
?: ?&(?=(^ +.flow.dead.ames-state) =(~m2 rto.metrics.state))
|
||||
peer-core
|
||||
(pu-emit %b %wait u.new-wake)
|
||||
::
|
||||
@ -5173,7 +5212,7 @@
|
||||
%= old
|
||||
cong
|
||||
:+ cong.old
|
||||
flow/`[~[/ames] /dead-flow `@da`(add now ~m2)]
|
||||
flow/~
|
||||
cork/`[~[/ames] /recork `@da`(add now ~d1)]
|
||||
::
|
||||
peers
|
||||
|
@ -789,8 +789,7 @@
|
||||
%. (~(put by connections.state) duct connection)
|
||||
(trace 2 |.("{<duct>} creating local"))
|
||||
::
|
||||
:_ state
|
||||
(subscribe-to-app [%ours ~] app.act inbound-request.connection)
|
||||
(request-to-app [%ours ~] app.act inbound-request.connection)
|
||||
:: +request: starts handling an inbound http request
|
||||
::
|
||||
++ request
|
||||
@ -964,8 +963,7 @@
|
||||
==
|
||||
::
|
||||
%app
|
||||
:_ state
|
||||
(subscribe-to-app identity app.action inbound-request.connection)
|
||||
(request-to-app identity app.action inbound-request.connection)
|
||||
::
|
||||
%authentication
|
||||
(handle-request:authentication secure host address [suv identity] request)
|
||||
@ -1100,11 +1098,24 @@
|
||||
%^ return-static-data-on-duct status 'text/html'
|
||||
(error-page status authenticated url.request tape)
|
||||
--
|
||||
:: +subscribe-to-app: subscribe to app and poke it with request data
|
||||
:: +request-to-app: subscribe to app and poke it with request data
|
||||
::
|
||||
++ subscribe-to-app
|
||||
++ request-to-app
|
||||
|= [=identity app=term =inbound-request:eyre]
|
||||
^- (list move)
|
||||
^- (quip move server-state)
|
||||
:: if the agent isn't running, we synchronously serve a 503
|
||||
::
|
||||
?. !<(? q:(need (need (rof ~ /eyre %gu [our app da+now] /$))))
|
||||
%^ return-static-data-on-duct 503 'text/html'
|
||||
%: error-page
|
||||
503
|
||||
?=(%ours -.identity)
|
||||
url.request.inbound-request
|
||||
"%{(trip app)} not running"
|
||||
==
|
||||
:: otherwise, subscribe to the agent and poke it with the request
|
||||
::
|
||||
:_ state
|
||||
:~ %+ deal-as
|
||||
/watch-response/[eyre-id]
|
||||
[identity our app %watch /http-response/[eyre-id]]
|
||||
|
@ -11,7 +11,7 @@
|
||||
::
|
||||
+$ lick-state
|
||||
$: %0
|
||||
unix-duct=duct
|
||||
unix-duct=_`duct`[//lick ~]
|
||||
owners=(map name duct)
|
||||
==
|
||||
::
|
||||
|
@ -306,6 +306,7 @@
|
||||
0xb.130c.ab37.ca24.49cd.aecb.23ba.70f1.6f1c.4d00.124e.c9a5.
|
||||
3413.3843.d81c.47c4.7040.6e62.3700.0200.0132.e1ab.9000
|
||||
==
|
||||
:- ~[/ames] [%pass /pump/~bud/0 %b %wait ~1111.1.5..00.02.00]
|
||||
==
|
||||
==
|
||||
:: publisher ames hears %kick ack
|
||||
|
@ -375,6 +375,7 @@
|
||||
|= [gang pov=path =view =beam]
|
||||
^- (unit (unit cage))
|
||||
?: =(%gd view) ``noun+!>(%base)
|
||||
?: =(%gu view) ``noun+!>(=(%app1 q.beam))
|
||||
?: &(=(%ca view) =(/gen/handler/hoon s.beam))
|
||||
:+ ~ ~
|
||||
vase+!>(!>(|=(* |=(* [[%404 ~] ~]))))
|
||||
@ -553,6 +554,21 @@
|
||||
(take /watch-response/[eyre-id] ~[/http-blah] sign)
|
||||
=/ headers ['content-type' 'text/html']~
|
||||
(expect-moves mos (ex-continue-response `[3 'ya!'] %.n) ~)
|
||||
::
|
||||
++ test-dead-app-request
|
||||
%- eval-mare
|
||||
=/ m (mare ,~)
|
||||
;< ~ bind:m perform-init-wo-timer
|
||||
;< ~ bind:m (wait ~d1)
|
||||
:: dead-app binds successfully
|
||||
::
|
||||
;< ~ bind:m (connect %dead-app /)
|
||||
;< ~ bind:m (wait ~d1)
|
||||
:: outside requests a path that dead-app has bound to
|
||||
::
|
||||
;< mos=(list move) bind:m (get '/' ~)
|
||||
=/ body `(error-page:eyre-gate 503 %.n '/' "%dead-app not running")
|
||||
(expect-moves mos (ex-response 503 ['content-type' 'text/html']~ body) ~)
|
||||
:: tests an app redirecting to the login handler, which then receives a post
|
||||
:: and redirects back to app
|
||||
::
|
||||
|
Loading…
Reference in New Issue
Block a user