-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix pkg#195 Handler wrappers deal with errors
TLDR; have the Handler wrappers generate the response packets for the errors instead of returning the errors. Errors from the handers was returned up the stack to the request-server handler call. In cases of errors the packet for the error was then generated using the passed in packet (the incoming packet). For file read/write/list operations the incoming packet data (includeing ID) is put in a queue/channel so that it can be handled by the same file handling code returned by the handler. Due to gorouting scheduling, in some cases the packets in the channel won't line up with the incoming packets. That is the worker that took an incoming packet with one ID might respond with a packet with a different ID. This doesn't matter as the reply order of packets doesn't matter. BUT when this response packet that doesn't match IDs with the incoming packet system returns an error, it uses the incoming packets ID to generate the error packet. So the error response would use that ID and the packet from the queue, once processed, would also use that ID (because on success it uses the ID from the packet in the queue). This patch fixes the issue by having the code that works with the packets, either incoming or from the queue, generate the error packet. So there is no chance of them getting out of sync.
- Loading branch information
Showing
3 changed files
with
71 additions
and
72 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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