| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent feb6e1f commit 6dbd63c
10 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -426,12 +426,10 @@ function socketCloseListener() { | |||
| 426 | 426 | req.emit('close'); | |
| 427 | 427 | if (!res.aborted && res.readable) { | |
| 428 | 428 | res.on('end', function() { | |
| 429 | - this.destroyed = true; | ||
| 430 | 429 | this.emit('close'); | |
| 431 | 430 | }); | |
| 432 | 431 | res.push(null); | |
| 433 | 432 | } else { | |
| 434 | - res.destroyed = true; | ||
| 435 | 433 | res.emit('close'); | |
| 436 | 434 | } | |
| 437 | 435 | } else { | |
@@ -545,7 +543,6 @@ function socketOnData(d) { | |||
| 545 | 543 | socket.readableFlowing = null; | |
| 546 | 544 | ||
| 547 | 545 | req.emit(eventName, res, socket, bodyHead); | |
| 548 | - req.destroyed = true; | ||
| 549 | 546 | req.emit('close'); | |
| 550 | 547 | } else { | |
| 551 | 548 | // Requested Upgrade or used CONNECT method, but have no handler. | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -119,8 +119,6 @@ IncomingMessage.prototype._read = function _read(n) { | |||
| 119 | 119 | // any messages, before ever calling this. In that case, just skip | |
| 120 | 120 | // it, since something else is destroying this connection anyway. | |
| 121 | 121 | IncomingMessage.prototype.destroy = function destroy(error) { | |
| 122 | - // TODO(ronag): Implement in terms of _destroy | ||
| 123 | - this.destroyed = true; | ||
| 124 | 122 | if (this.socket) | |
| 125 | 123 | this.socket.destroy(error); | |
| 126 | 124 | return this; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -205,10 +205,7 @@ function onServerResponseClose() { | |||
| 205 | 205 | // Ergo, we need to deal with stale 'close' events and handle the case | |
| 206 | 206 | // where the ServerResponse object has already been deconstructed. | |
| 207 | 207 | // Fortunately, that requires only a single if check. :-) | |
| 208 | - if (this._httpMessage) { | ||
| 209 | - this._httpMessage.destroyed = true; | ||
| 210 | - this._httpMessage.emit('close'); | ||
| 211 | - } | ||
| 208 | + if (this._httpMessage) this._httpMessage.emit('close'); | ||
| 212 | 209 | } | |
| 213 | 210 | ||
| 214 | 211 | ServerResponse.prototype.assignSocket = function assignSocket(socket) { | |
@@ -537,7 +534,6 @@ function abortIncoming(incoming) { | |||
| 537 | 534 | while (incoming.length) { | |
| 538 | 535 | const req = incoming.shift(); | |
| 539 | 536 | req.aborted = true; | |
| 540 | - req.destroyed = true; | ||
| 541 | 537 | req.emit('aborted'); | |
| 542 | 538 | req.emit('close'); | |
| 543 | 539 | } | |
@@ -664,13 +660,11 @@ function clearIncoming(req) { | |||
| 664 | 660 | if (parser && parser.incoming === req) { | |
| 665 | 661 | if (req.readableEnded) { | |
| 666 | 662 | parser.incoming = null; | |
| 667 | - req.destroyed = true; | ||
| 668 | 663 | req.emit('close'); | |
| 669 | 664 | } else { | |
| 670 | 665 | req.on('end', clearIncoming); | |
| 671 | 666 | } | |
| 672 | 667 | } else { | |
| 673 | - req.destroyed = true; | ||
| 674 | 668 | req.emit('close'); | |
| 675 | 669 | } | |
| 676 | 670 | } | |
@@ -714,7 +708,6 @@ function resOnFinish(req, res, socket, state, server) { | |||
| 714 | 708 | } | |
| 715 | 709 | ||
| 716 | 710 | function emitCloseNT(self) { | |
| 717 | - self.destroyed = true; | ||
| 718 | 711 | self.emit('close'); | |
| 719 | 712 | } | |
| 720 | 713 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -33,10 +33,7 @@ server.listen(0, common.mustCall(function() { | |||
| 33 | 33 | path: 'example.com:443' | |
| 34 | 34 | }, common.mustNotCall()); | |
| 35 | 35 | ||
| 36 | - assert.strictEqual(req.destroyed, false); | ||
| 37 | - req.on('close', common.mustCall(() => { | ||
| 38 | - assert.strictEqual(req.destroyed, true); | ||
| 39 | - })); | ||
| 36 | + req.on('close', common.mustCall()); | ||
| 40 | 37 | ||
| 41 | 38 | req.on('connect', common.mustCall(function(res, socket, firstBodyChunk) { | |
| 42 | 39 | console.error('Client got CONNECT request'); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -62,10 +62,7 @@ server.listen(0, common.mustCall(() => { | |||
| 62 | 62 | assert.strictEqual(socket._httpMessage, req); | |
| 63 | 63 | })); | |
| 64 | 64 | ||
| 65 | - assert.strictEqual(req.destroyed, false); | ||
| 66 | - req.on('close', common.mustCall(() => { | ||
| 67 | - assert.strictEqual(req.destroyed, true); | ||
| 68 | - })); | ||
| 65 | + req.on('close', common.mustCall()); | ||
| 69 | 66 | ||
| 70 | 67 | req.on('connect', common.mustCall((res, socket, firstBodyChunk) => { | |
| 71 | 68 | // Make sure this request got removed from the pool. | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -22,7 +22,6 @@ | |||
| 22 | 22 | 'use strict'; | |
| 23 | 23 | const common = require('../common'); | |
| 24 | 24 | const http = require('http'); | |
| 25 | - const assert = require('assert'); | ||
| 26 | 25 | ||
| 27 | 26 | const server = http.Server(function(req, res) { | |
| 28 | 27 | res.writeHead(200, { 'Content-Type': 'text/plain' }); | |
@@ -44,12 +43,6 @@ server.listen(0, common.mustCall(function() { | |||
| 44 | 43 | }); | |
| 45 | 44 | })); | |
| 46 | 45 | ||
| 47 | - res.on('end', common.mustCall(() => { | ||
| 48 | - assert.strictEqual(res.destroyed, false); | ||
| 49 | - })); | ||
| 50 | - assert.strictEqual(res.destroyed, false); | ||
| 51 | - res.on('close', common.mustCall(() => { | ||
| 52 | - assert.strictEqual(res.destroyed, true); | ||
| 53 | - })); | ||
| 46 | + res.on('end', common.mustCall()); | ||
| 54 | 47 | })); | |
| 55 | 48 | })); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -8,25 +8,13 @@ const server = http.Server(common.mustCall((req, res) => { | |||
| 8 | 8 | let resClosed = false; | |
| 9 | 9 | ||
| 10 | 10 | res.end(); | |
| 11 | - let resFinished = false; | ||
| 12 | 11 | res.on('finish', common.mustCall(() => { | |
| 13 | - resFinished = true; | ||
| 14 | - assert.strictEqual(resClosed, false); | ||
| 15 | - assert.strictEqual(res.destroyed, false); | ||
| 16 | 12 | assert.strictEqual(resClosed, false); | |
| 17 | 13 | })); | |
| 18 | - assert.strictEqual(req.destroyed, false); | ||
| 19 | 14 | res.on('close', common.mustCall(() => { | |
| 20 | 15 | resClosed = true; | |
| 21 | - assert.strictEqual(resFinished, true); | ||
| 22 | - assert.strictEqual(res.destroyed, true); | ||
| 23 | - })); | ||
| 24 | - assert.strictEqual(req.destroyed, false); | ||
| 25 | - req.on('end', common.mustCall(() => { | ||
| 26 | - assert.strictEqual(req.destroyed, false); | ||
| 27 | 16 | })); | |
| 28 | 17 | req.on('close', common.mustCall(() => { | |
| 29 | - assert.strictEqual(req.destroyed, true); | ||
| 30 | 18 | assert.strictEqual(req._readableState.ended, true); | |
| 31 | 19 | })); | |
| 32 | 20 | res.socket.on('close', () => server.close()); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -22,7 +22,6 @@ | |||
| 22 | 22 | 'use strict'; | |
| 23 | 23 | const common = require('../common'); | |
| 24 | 24 | const http = require('http'); | |
| 25 | - const assert = require('assert'); | ||
| 26 | 25 | ||
| 27 | 26 | { | |
| 28 | 27 | const server = http.createServer( | |
@@ -40,9 +39,7 @@ const assert = require('assert'); | |||
| 40 | 39 | res.on('data', common.mustCall(() => { | |
| 41 | 40 | res.destroy(); | |
| 42 | 41 | })); | |
| 43 | - assert.strictEqual(res.destroyed, false); | ||
| 44 | 42 | res.on('close', common.mustCall(() => { | |
| 45 | - assert.strictEqual(res.destroyed, true); | ||
| 46 | 43 | server.close(); | |
| 47 | 44 | })); | |
| 48 | 45 | }) | |
@@ -64,12 +61,7 @@ const assert = require('assert'); | |||
| 64 | 61 | http.get( | |
| 65 | 62 | { port: server.address().port }, | |
| 66 | 63 | common.mustCall((res) => { | |
| 67 | - assert.strictEqual(res.destroyed, false); | ||
| 68 | - res.on('end', common.mustCall(() => { | ||
| 69 | - assert.strictEqual(res.destroyed, false); | ||
| 70 | - })); | ||
| 71 | 64 | res.on('close', common.mustCall(() => { | |
| 72 | - assert.strictEqual(res.destroyed, true); | ||
| 73 | 65 | server.close(); | |
| 74 | 66 | })); | |
| 75 | 67 | res.resume(); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -23,7 +23,6 @@ | |||
| 23 | 23 | require('../common'); | |
| 24 | 24 | const http = require('http'); | |
| 25 | 25 | const fork = require('child_process').fork; | |
| 26 | - const assert = require('assert'); | ||
| 27 | 26 | ||
| 28 | 27 | if (process.env.NODE_TEST_FORK_PORT) { | |
| 29 | 28 | const req = http.request({ | |
@@ -38,9 +37,7 @@ if (process.env.NODE_TEST_FORK_PORT) { | |||
| 38 | 37 | const server = http.createServer((req, res) => { | |
| 39 | 38 | res.writeHead(200, { 'Content-Length': '42' }); | |
| 40 | 39 | req.pipe(res); | |
| 41 | - assert.strictEqual(req.destroyed, false); | ||
| 42 | 40 | req.on('close', () => { | |
| 43 | - assert.strictEqual(req.destroyed, true); | ||
| 44 | 41 | server.close(); | |
| 45 | 42 | res.end(); | |
| 46 | 43 | }); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments