Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Do not silently discard undelivered messages
The plugin no longer discards messages which it fails to send if the server disconnects and sends some content prior to the disconnection. Example situation before the fix: 1. A connection is established between a server and the plugin. 2. The plugin delivers some messages to the server. 2.1) It may or may not read something that it received from the server. 2.2) It sends the payload to the server. 3. The server sends some content back and disconnects. 4. The plugin tries to deliver some other messages to the server. 4.1) It tries to read (if r.any?) and expects to get an EOFError in case the server just died. 4.2) No error is thrown as some content just arrived from the server. It is discarded. 4.3) The first payload is written to the socket, no error being thrown. 4.4) The next payload finally fails with EOFError upon reading from the socket and an retry follows. This commit fixes the 4.1 and 4.2 phases. The reading is now performed repeatedly while there's still something to read left so that we don't miss the EOFError exception.
- Loading branch information