Fix intermitent condition where onerror is called when conn is closed by client #72
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.
The test "onerror is not called when conn is closed by client" intermittently fails.
According to some resources, such as RFC-1122 (4.2.2.12 Closing a Connection): if the host actively closes a connection, while still having unread incoming data available, the host should send the signal
RST
(losing any received data) instead ofFIN
. This may or may not be what is happening, but there's there's something causing aRST
to be received by the client at least some of the time.This pull request proposes the solution of calling
socket.destroy()
incloseSocket()
to ignore the possibility of aRST
response. This was also the solution in postwait/node-amqp#444.See recent past failures: