Repository navigation
Conversation
Only the whole command @EXIT passes the command validator, on any connection, so the listener closes the connection on it with nothing written. Commands sent before it are answered, and anything after it is not handled. A longer command that starts with @EXIT is judged as the command it is, including when only its first 16 bytes have arrived, and a command that only resembles it, such as exit, is still answered AT0003. The listener test that names this behaviour now asserts the close and that nothing was written, and its file sets the atServer's atSign in setUp rather than relying on an earlier test.
The scenario, and the DoS line's bound on how long closing the connection waits for earlier replies to be sent.
The atServer closes a connection by destroying its socket, which drops anything written to it that has not yet been handed on. So that a reply written before @EXIT arrives whole, the listener flushes a socket connection, waiting at most five seconds, before it closes it. A WebSocket connection is closed without a flush. The functional test file is formatted to its package's language version.
The scenario, and an example row for a client connected over a WebSocket.
The validator and WebSocket tests move beside the others, under the scenario and example row each proves, and the new scenario's command is also sent in one write. The catalogue's connection is marked closed once it is closed, as the real one is, and its socket's flush completes.
The warning names the connection. Unit tests now pin that the close waits for the socket's flush, and that it waits no more than five seconds.
The pol connection the lookup tests use moves to test/pol_peer.dart, so another test can prove a peer by pol the same way.
The large-response test now waits for the update's own answer before it measures the reply, and deletes its key at tear-down.
The WebSocket example asserts that nothing is logged, so dropping the guard that skips the flush for a WebSocket goes red, and the five-second bound gains a case whose flush throws at once, as a real socket's does. The test FakeSocket's flush now completes, so the older tests that send @EXIT take the path a working socket takes, the waits poll rather than sleep, and two comments that state a constraint become NOTEs.
An atSign with a multi-byte character can be split between two reads, so the raw connection decodes its stream as a whole. Comments that state a constraint become NOTEs, one that restated the code goes, and the pol example's roles move to main's dartdoc.
Contributor
Author
|
@cconstab enforcing |
@exit
listen and acceptRequests take one callback, and a WebSocket connection takes the Socket it runs over. The WebSocket example now records what reaches the WebSocket through addStream, the path its writes take, so a reply to the exit command shows up there.
The atServer no longer flushes a socket connection, for up to five seconds, before it closes it on the exit command, and no longer logs a warning when that flush fails. It closes the connection the way it closes one whose client has gone: a socket is destroyed, a WebSocket is closed, and the connection leaves the pool. A reply still being sent to a command that came before the exit command may lose its end. The flush could not run once writes went through the write queue, which binds the socket to a stream: it threw, and the close went ahead. The unit tests of the flush, its five-second bound and its warning go with it, and the examples that close on the exit command now check that the connection leaves the pool.
The atServer no longer waits for earlier replies to be sent before it closes a connection on the exit command, so a large reply sent just before it may lose its end, and nothing tests that it arrives whole.
The scenario that a large response sent before the exit command arrives whole is retired, with the five-second bound on waiting for it. The feature says instead that the atServer does not wait for earlier answers to be sent, so the end of a long one may not arrive, and that a client needing an answer whole waits for it before sending the exit command.
A merge from trunk kept the at_commons 5.22.0 line beside the 5.23.0 line that replaced it, so the 3.18.0 section is back to what trunk has.
The line now says only that the atServer closes the connection, writing nothing, on the exit command, rather than answering it with AT0003. It opens a 3.20.1 section, since 3.20.0 has shipped, rather than staying in the 3.18.0 section where a merge from trunk had left it.
A reply to the exit command binds the WebSocket's write queue, which holds back the close, so the example checked the close first and went red on it rather than on the reply. It now checks what was written first, and names it.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
- What I did
@exit, rather than answering it with AT0003features/connection/exit.feature- How I did it
See commits
- How to verify it
Tests pass, including all four live packs locally against this build
- Description for the changelog
fix: an atServer closes the connection, writing nothing, when a client sends
@exit, rather than answering it with AT0003.