The previous commit counted a body as still arriving whenever less of it
had been read than its Content-Length. Before the first read that holds
for a request waiting in bodyRoom.take, which is magpie's own wait. Its
client may have sent the whole body already, and a 408 there tells an
SDK to send it again at once, onto a room already full. bodyArriving
now holds only once the body's read has begun ("body" wait seen) and
while no body-room wait is under way. That is the gap between two reads
that #4511's full run raced into.
The patch's TestUnroutedBodyShortOfItsLengthAnswered408 asserted the
408 in the room wait. It is replaced by:
- TestUnroutedBodyRoomWaitNot408: same setup, not a 408.
- TestUnroutedBodyArrivingBetweenReads: not read yet / in the room wait /
between reads / read whole / no length.
Reproduced #4511 by injecting a gap. waitedBody.Read ended its wait and
slept 30ms after each read, and TestUnroutedTrickledBodyAnswered408
-count=5:
- with the narrowed check: ok 5 of 5;
- with giveUp back to "case u.inBody():": red, answered 504 "held this
request for 1s without routing", the CI red.
Broken by hand: bodyArriving back to the patch's (length only). Both
new tests fail, and the room wait gets the 408.
Run (on mote, through mote-run):
- Full `go test -tags nogui -count=1 -timeout 45m ./...` with this stack
on c30d3b7b6: 82 packages ok. internal/gui was red only on
TestSettingsSaveKeepsWhatItDoesNotSend (#4514, SearchAll from
b09349d17) and TestColdTurnsTaken (#4510). Both are filed, and neither
touches this stack.
- Rebased onto 29d0ab39f, which changed internal/gateway since then:
gofmt -l, go vet (darwin, GOOS=linux -tags nogui, GOOS=windows) and
go test -count=1 ./internal/gateway ./internal/usage ./internal/provider
./internal/sessions all ok at the pushed head. go build ./... ok for
darwin, linux (nogui) and windows.
- go test -race of the gateway tests this stack adds or touches, on
the stack at fb29cd30f: ok.