Merge pull request #6046 from urbit/lf/fix-cork

ames: prevent crashes when corking an alien flow
This commit is contained in:
jose 2022-11-15 08:43:46 +01:00 committed by GitHub
commit 1b4f045499
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1777,14 +1777,16 @@
++ on-cork
|= =ship
^+ event-core
=/ =plea [%$ /flow [%cork ~]]
=/ ship-state (~(get by peers.ames-state) ship)
::
?> ?=([~ %known *] ship-state)
?. ?=([~ %known *] ship-state)
%+ enqueue-alien-todo ship
|= todos=alien-agenda
todos(messages [[duct plea] messages.todos])
=/ =peer-state +.u.ship-state
=/ =channel [[our ship] now channel-state -.peer-state]
::
=^ =bone ossuary.peer-state (bind-duct ossuary.peer-state duct)
=/ =plea [%$ /flow [%cork ~]]
::
=. closing.peer-state (~(put in closing.peer-state) bone)
%- %^ trace msg.veb ship
@ -2058,6 +2060,8 @@
=. event-core
%+ reel messages.todos
|= [[=^duct =plea] core=_event-core]
?: ?=(%$ -.plea)
(on-cork:core(duct duct) ship)
(on-plea:core(duct duct) ship plea)
:: apply outgoing packet blobs
::