fix(v4.0.0): a waiting node goes on passing on and paying; KILL is not held by a stuck node
Found in the five-node test, each with a check that failed first: - A node with answers it could not give to two stuck senders began no text at all. It now holds back only text from a sender whose own answer is still with it. - KILL waited to tell a stuck node, and a typed line that broke it left the nodes after it untold. GONE is put with the messages waiting, as how text ended is, and goes when it can. - So that 'tell, then wait' still works, AWAIT does what (IDLE) does but for beginning text: it looks through the messages waiting, offers what is to be passed on and what is owed, and sleeps in the wait. A waiting node no longer keeps back what passes through it. - A node in the wait with an offer on a port that turns out to have nothing on it is woken and told so (which port: 2 * V4_PORTS + k); no error is raised on it. (GATE) makes it error 18; (IDLE) and AWAIT let the message go. Before, removing a node raised 'No one on that port' on the unrelated text of a neighbour that had something queued for it. make -C v4 test and sanitize at both widths, hosted-check. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
353783726d
commit
ec817a8264
+12
-8
@@ -251,17 +251,20 @@ header CMOVE
|
||||
\ ( port to -- ) take in a message and keep it
|
||||
: (TAKE) (TAKE-HDR) jump (TAKE-KEEP)
|
||||
|
||||
\ ( -- flag ) THE WAIT, once. Whatever has been offered stands until
|
||||
\ this returns. Zero: a word came for this node instead; that whole
|
||||
\ message has been taken in and kept, (TAKE), and its seven words are
|
||||
\ still in (MQ-HDR). Not zero: an offer was taken; B is at the port it
|
||||
\ was taken on, and (GATE-PORT) holds that port's address.
|
||||
\ ( -- how ) THE WAIT, once. Whatever has been offered stands until
|
||||
\ this returns. 0: a word came for this node instead; that whole message
|
||||
\ has been taken in and kept, (TAKE), and its seven words are still in
|
||||
\ (MQ-HDR). -1: an offer was taken; B is at the port it was taken on, and
|
||||
\ (GATE-PORT) holds that port's address. 1: there is nothing on a port
|
||||
\ that had an offer: no one will ever take it.
|
||||
: (OFFERS)
|
||||
(WAIT) b! @b push (PORT)+9 b! @b \ ( which ) R: the word
|
||||
dup -PORTS + -if TAKEN
|
||||
drop (PORT) + dup b! pop (TAKE) 0 ; \ a word, from that port: the message's first
|
||||
TAKEN: (PORT) + (GATE-PORT) a! ! drop pop drop
|
||||
TAKEN: dup -PORTS + -if NOONE \ ( which k x ) k: the port, by its number
|
||||
drop (PORT) + (GATE-PORT) a! ! drop pop drop
|
||||
(GATE-PORT) a! @ b! -1 ;
|
||||
NOONE: drop drop drop pop drop 1 ;
|
||||
|
||||
\ ( w port -- ) BEGIN A MESSAGE: the word, its first, is offered on the
|
||||
\ port, by its address, until it is taken; whatever is written to this
|
||||
@@ -274,11 +277,12 @@ header CMOVE
|
||||
\ the messages waiting and is done next. It is how a node whose text must
|
||||
\ begin a message to a node that is stuck is typed to. Not while (QUIET)
|
||||
\ is set: what waits then is no text's doing.
|
||||
\ With nothing on the port the fabric raises error 18.
|
||||
\ With nothing on the port it is error 18.
|
||||
: (GATE1) ( port -- )
|
||||
(GATE-PORT) a! !
|
||||
L: (GATE-WORD) a! @ (GATE-PORT) a! @ -PORTS - 4 + a! ! \ the offer
|
||||
(OFFERS) if CAME drop ;
|
||||
(OFFERS) if CAME -if NOONE drop ;
|
||||
NOONE: drop NODE-ERROR b! 18 !b ; \ no one on that port
|
||||
CAME: drop
|
||||
(QUIET) a! @ if TEXTS drop jump L
|
||||
TEXTS: drop
|
||||
|
||||
Reference in New Issue
Block a user