Conversation
The id stayed on the Client after the handler returned, so chat and broadcasts carried it until the next command, while replies from DB callbacks carried whichever id came later. _handle now restores the id when it returns, and callbacks that answer the client put back the id captured when the work was deferred. Offline messages delivered after LOGIN are left without one, because they are other players' messages rather than the answer. Fixes ScarylePoo#60.
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.
A client that sends
#5 GETIP bobgot#5on every line the server sent it afterwards, not just the reply. Chat from other players, status changes and broadcasts all arrived wearing an id that had nothing to do with them, until the client's next command replaced it. Handlers that wait on the database failed the other way: by the time the reply was ready the client may have sent something else, so the reply carried that command's id, or none.Two changes. The id is now restored when a handler returns, so only lines sent while the command is being handled carry it. And a handler that defers work captures the id at that point, so the reply carries the id of the command it answers whatever the client has sent since.
Restoring rather than clearing matters because ChanServ runs a mod command typed into
#moderatorback through the same dispatch path while that client'sSAYis still being handled. Clearing would drop the id from the rest of the outer command.Offline messages delivered after
LOGINare deliberately left without an id. They are other players' messages arriving late, not the answer to anything, and the point of this change is that an id means "this answers the command you sent".The message id section of
PROTOCOL.mdwas a documented gap. It now says which lines carry an id and which do not, which is the thing a client author needs in order to rely on this.One path has no test: a login queued under write-buffer backpressure carries its id through the drain loop by the same mechanism, but I did not find a way to drive backpressure from a test client.
Fixes #60.