You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This slightly alters the behaviour of session close by using .end() on a
session socket instead of .destroy(). This allows the socket to finish
transmitting data, receive proper FIN packet and avoid ECONNRESET errors
upon graceful close.
Now after the session is closed we call ReadStart() on the underlying
stream to allow socket to receive the remaining data and FIN packet.
Previously only ReadStop() was used therefore blocking the receival of
FIN by the socket and 'end' event after .end() call.
onStreamClose now directly calls stream.destroy() instead of
kMaybeDestroy because the latter will first check that the stream has
writableFinished set. And that may not be true as we have just
(synchronously) called .end() on the stream if it was not closed and
that doesn't give it enough time to finish. Furthermore there is no
point in waiting for 'finish' as the other party have already closed the
stream and we won't be able to write anyway.
Few tests got changed because of this. They weren't correctly handling
graceful session close. This includes:
* not reading request data (on client side)
* not reading push stream data (on client side)
* relying on socket.destroy() (on client) to finish server session
due to the destroy of the socket without closing the server session.
As the goaway itself is *not* a session close.
This also led to a few missing 'close' session events. Added appropriate
mustCall checks.
0 commit comments