toy-rpc icon indicating copy to clipboard operation
toy-rpc copied to clipboard

Proper error handling for connection interruption

Open minghuaw opened this issue 4 years ago • 1 comments

#27

minghuaw avatar Oct 25 '21 23:10 minghuaw

Because each HTTP framework has its own wrapper for WebSocket errors, all WebSocket errors that causes failure to write a message will be treated as an IoError(_). An IoError(_) will cause the writer loop to stop which should then drop the connection (at least the write half of the connection), and further messages sent to the writer loop will encounter an error, which will be used to indicate an underlying connection problem (at least on the writer half). The broker could then pass this error to Call which could then relay the information to the user to decide whether to reconnect.

The error propagation chain is unnecessarily long, and this is due to a bad design decision for separating broker-reader-writer as if they are separate actors. A new design where broker is able to easily detect connection problem (at least with the write side) should be implemented in 0.9

minghuaw avatar Oct 26 '21 04:10 minghuaw