http2: simplify subsequent rstStream calls#16753
http2: simplify subsequent rstStream calls#16753apapirovski wants to merge 1 commit intonodejs:masterfrom
Conversation
Do not call destroy each time rstStream is called since the first call (or receipt of rst frame) will always trigger destroy. Expand existing test for this behaviour.
| // skip straight to destroy | ||
| stream.destroy(); | ||
| // rst has already been called by self or peer, | ||
| // do not call again |
There was a problem hiding this comment.
Also to expand on what this says, we can't throw here because it's possible we received an RST frame from the remote peer and are getting ready to destroy but have not done that yet, so the user code calls rstStream in the meantime — that's where it should just gracefully exit rather than throw.
There was a problem hiding this comment.
Can you assert(stream.destroyed); here instead? If I understand correctly, that should always be true?
There was a problem hiding this comment.
Not necessarily since the destruction gets scheduled using setImmediate or process.nextTick. (Also when stream.destroyed then this function will throw further up above.)
| // skip straight to destroy | ||
| stream.destroy(); | ||
| // rst has already been called by self or peer, | ||
| // do not call again |
There was a problem hiding this comment.
Can you assert(stream.destroyed); here instead? If I understand correctly, that should always be true?
|
Landed in 795a964 |
Do not call destroy each time rstStream is called since the first call (or receipt of rst frame) will always trigger destroy. Expand existing test for this behaviour. PR-URL: #16753 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com>
Do not call destroy each time rstStream is called since the first call (or receipt of rst frame) will always trigger destroy. Expand existing test for this behaviour. PR-URL: #16753 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com>
Do not call destroy each time rstStream is called since the first call (or receipt of rst frame) will always trigger destroy. Expand existing test for this behaviour. PR-URL: #16753 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com>
Do not call destroy each time rstStream is called since the first call (or receipt of rst frame) will always trigger destroy. Expand existing test for this behaviour. PR-URL: #16753 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com>
Do not call destroy each time rstStream is called since the first call (or receipt of rst frame) will always trigger destroy. Expand existing test for this behaviour.
Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passesAffected core subsystem(s)
http2, test