http2: destroy() stream, upon errnoException

First steps towards #19060

PR-URL: https://github.com/nodejs/node/pull/19389
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
This commit is contained in:
Sarat Addepalli 2018-03-16 17:29:47 +05:30 committed by Anna Henningsen
parent 38bae5dc23
commit 84afd6e492
No known key found for this signature in database
GPG Key ID: 9C63F3A6CD2AD8F9
1 changed files with 2 additions and 2 deletions

View File

@ -1680,7 +1680,7 @@ class Http2Stream extends Duplex {
req.async = false;
const err = createWriteReq(req, handle, data, encoding);
if (err)
throw errnoException(err, 'write', req.error);
return this.destroy(errnoException(err, 'write', req.error), cb);
trackWriteState(this, req.bytes);
}
@ -1723,7 +1723,7 @@ class Http2Stream extends Duplex {
}
const err = handle.writev(req, chunks);
if (err)
throw errnoException(err, 'write', req.error);
return this.destroy(errnoException(err, 'write', req.error), cb);
trackWriteState(this, req.bytes);
}