GeezerVison is showing github.com — stream: do not emit `end` on readable error · nodejs/node@ef992f6
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: lib/internal/streams/readable.js +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -1328,7 +1328,7 @@ function endReadableNT(state, stream) { | 1328 | 1328 | debug('endReadableNT', state.endEmitted, state.length); | 1329 | 1329 |
| 1330 | 1330 | // Check that we didn't get one last unshift. | 1331 | | - if (!state.errorEmitted && !state.closeEmitted && | | 1331 | + if (!state.errored && !state.closeEmitted && | 1332 | 1332 | !state.endEmitted && state.length === 0) { | 1333 | 1333 | state.endEmitted = true; | 1334 | 1334 | stream.emit('end'); | |
Collapse file Copy file name to clipboardExpand all lines: test/parallel/test-http2-client-destroy.js +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -163,7 +163,7 @@ const { getEventListeners } = require('events'); | 163 | 163 |
| 164 | 164 | client.close(); | 165 | 165 | req.resume(); | 166 | | - req.on('end', common.mustCall()); | | 166 | + req.on('end', common.mustNotCall()); | 167 | 167 | req.on('close', common.mustCall(() => server.close())); | 168 | 168 | })); | 169 | 169 | } | |
Collapse file Copy file name to clipboardExpand all lines: test/parallel/test-http2-client-onconnect-errors.js +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -102,7 +102,7 @@ function runTest(test) { | 102 | 102 | }); | 103 | 103 | } | 104 | 104 |
| 105 | | - req.on('end', common.mustCall()); | | 105 | + req.on('end', common.mustNotCall()); | 106 | 106 | req.on('close', common.mustCall(() => { | 107 | 107 | client.destroy(); | 108 | 108 |
| |
Collapse file Copy file name to clipboardExpand all lines: test/parallel/test-http2-compat-serverresponse-destroy.js +2-2Lines changed: 2 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -62,7 +62,7 @@ server.listen(0, common.mustCall(() => { | 62 | 62 | req.on('close', common.mustCall(() => countdown.dec())); | 63 | 63 |
| 64 | 64 | req.resume(); | 65 | | - req.on('end', common.mustCall()); | | 65 | + req.on('end', common.mustNotCall()); | 66 | 66 | } | 67 | 67 |
| 68 | 68 | { | @@ -77,6 +77,6 @@ server.listen(0, common.mustCall(() => { | 77 | 77 | req.on('close', common.mustCall(() => countdown.dec())); | 78 | 78 |
| 79 | 79 | req.resume(); | 80 | | - req.on('end', common.mustCall()); | | 80 | + req.on('end', common.mustNotCall()); | 81 | 81 | } | 82 | 82 | })); |
Collapse file Copy file name to clipboardExpand all lines: test/parallel/test-http2-empty-frame-without-eof.js +3-1Lines changed: 3 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -34,7 +34,9 @@ async function main() { | 34 | 34 | client.on('error', common.expectsError(expected)); | 35 | 35 | } | 36 | 36 | stream.resume(); | 37 | | - await once(stream, 'end'); | | 37 | + await new Promise((resolve) => { | | 38 | + stream.once('close', resolve); | | 39 | + }); | 38 | 40 | client.close(); | 39 | 41 | } | 40 | 42 | server.close(); | |
Collapse file Copy file name to clipboardExpand all lines: test/parallel/test-http2-max-concurrent-streams.js +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -45,7 +45,7 @@ server.listen(0, common.mustCall(() => { | 45 | 45 | req.on('aborted', common.mustCall()); | 46 | 46 | req.on('response', common.mustNotCall()); | 47 | 47 | req.resume(); | 48 | | - req.on('end', common.mustCall()); | | 48 | + req.on('end', common.mustNotCall()); | 49 | 49 | req.on('close', common.mustCall(() => countdown.dec())); | 50 | 50 | req.on('error', common.expectsError({ | 51 | 51 | code: 'ERR_HTTP2_STREAM_ERROR', | |
Collapse file Copy file name to clipboardExpand all lines: test/parallel/test-http2-multi-content-length.js +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -54,7 +54,7 @@ server.listen(0, common.mustCall(() => { | 54 | 54 | // header to be set for non-payload bearing requests... | 55 | 55 | const req = client.request({ 'content-length': 1 }); | 56 | 56 | req.resume(); | 57 | | - req.on('end', common.mustCall()); | | 57 | + req.on('end', common.mustNotCall()); | 58 | 58 | req.on('close', common.mustCall(() => countdown.dec())); | 59 | 59 | req.on('error', common.expectsError({ | 60 | 60 | code: 'ERR_HTTP2_STREAM_ERROR', | |
Collapse file Copy file name to clipboardExpand all lines: test/parallel/test-http2-respond-file-fd-invalid.js +2-1Lines changed: 2 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -40,7 +40,8 @@ server.listen(0, () => { | 40 | 40 | req.on('response', common.mustCall()); | 41 | 41 | req.on('error', errorCheck); | 42 | 42 | req.on('data', common.mustNotCall()); | 43 | | - req.on('end', common.mustCall(() => { | | 43 | + req.on('end', common.mustNotCall()); | | 44 | + req.on('close', common.mustCall(() => { | 44 | 45 | assert.strictEqual(req.rstCode, NGHTTP2_INTERNAL_ERROR); | 45 | 46 | client.close(); | 46 | 47 | server.close(); | |
Collapse file Copy file name to clipboardExpand all lines: test/parallel/test-http2-respond-nghttperrors.js +2-1Lines changed: 2 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -83,12 +83,13 @@ function runTest(test) { | 83 | 83 | name: 'Error', | 84 | 84 | message: 'Stream closed with error code NGHTTP2_INTERNAL_ERROR' | 85 | 85 | })); | | 86 | + req.on('end', common.mustNotCall()); | 86 | 87 |
| 87 | 88 | currentError = test; | 88 | 89 | req.resume(); | 89 | 90 | req.end(); | 90 | 91 |
| 91 | | - req.on('end', common.mustCall(() => { | | 92 | + req.on('close', common.mustCall(() => { | 92 | 93 | client.close(); | 93 | 94 |
| 94 | 95 | if (!tests.length) { | |
Collapse file Copy file name to clipboardExpand all lines: test/parallel/test-http2-respond-with-fd-errors.js +2-1Lines changed: 2 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -91,12 +91,13 @@ function runTest(test) { | 91 | 91 | name: 'Error', | 92 | 92 | message: 'Stream closed with error code NGHTTP2_INTERNAL_ERROR' | 93 | 93 | })); | | 94 | + req.on('end', common.mustNotCall()); | 94 | 95 |
| 95 | 96 | currentError = test; | 96 | 97 | req.resume(); | 97 | 98 | req.end(); | 98 | 99 |
| 99 | | - req.on('end', common.mustCall(() => { | | 100 | + req.on('close', common.mustCall(() => { | 100 | 101 | client.close(); | 101 | 102 |
| 102 | 103 | if (!tests.length) { | |
|