Commit Graph

688 Commits

Author SHA1 Message Date
Matteo Collina
8508edbf32 net: implement capture rejections for 'connection' event
PR-URL: https://github.com/nodejs/node/pull/27867
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
2019-12-03 12:14:52 +01:00
Sebastien Ahkrin
2070d3f8eb
lib: enforce use of primordial Number
PR-URL: https://github.com/nodejs/node/pull/30700
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
2019-11-30 13:58:25 +01:00
Michaël Zasso
1f9a5ae7aa
lib: use static Number properties from primordials
PR-URL: https://github.com/nodejs/node/pull/30686
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2019-11-30 13:45:38 +01:00
Michaël Zasso
7fc5980cfe
lib: enforce use of Boolean from primordials
Refs: https://github.com/nodejs/node/issues/30697

PR-URL: https://github.com/nodejs/node/pull/30698
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com>
2019-11-30 13:37:23 +01:00
Michaël Zasso
141a6e34ee
lib: enforce use of Array from primordials
PR-URL: https://github.com/nodejs/node/pull/30635
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
2019-11-27 19:29:01 +01:00
Michaël Zasso
0646eda4fc
lib: flatten access to primordials
Store all primordials as properties of the primordials object.
Static functions are prefixed by the constructor's name and prototype
methods are prefixed by the constructor's name followed by "Prototype".
For example: primordials.Object.keys becomes primordials.ObjectKeys.

PR-URL: https://github.com/nodejs/node/pull/30610
Refs: https://github.com/nodejs/node/issues/29766
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
2019-11-25 10:28:15 +01:00
nathias
5de2afb94e net: replaced vars to lets and consts
PR-URL: https://github.com/nodejs/node/pull/30401
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
2019-11-24 11:40:55 +05:30
Guilherme Goncalves
5e4d99ae6e net: destructure primordials
Refs: https://github.com/nodejs/node/issues/29766
PR-URL: https://github.com/nodejs/node/pull/30447
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Denys Otrishko <shishugi@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
2019-11-19 17:54:39 +05:30
Anna Henningsen
1447a79dc4
net: treat ENOTCONN at shutdown as success
While it is not entirely clear why this condition is being
triggered, it does resolve a reported bug.

Fixes: https://github.com/nodejs/node/issues/26315

PR-URL: https://github.com/nodejs/node/pull/29912
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2019-10-12 03:09:22 +02:00
Robert Nagy
a57da278f8 net: emit close on unconnected socket
Socket should always emit 'close'. Regardless
whether it has been connected or not.

PR-URL: https://github.com/nodejs/node/pull/29803
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Minwoo Jung <minwoo@nodesource.com>
2019-10-03 15:25:52 -07:00
Chetan Karande
fed05cc414 stream: cleanup use of internal ended state
PR-URL: https://github.com/nodejs/node/pull/29645
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
2019-09-24 06:42:56 +02:00
Brian White
8292b280ec
net: allow reading data into a static buffer
Co-Authored-By: Anna Henningsen <anna@addaleax.net>

PR-URL: https://github.com/nodejs/node/pull/25436
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2019-08-23 17:05:52 -04:00
Robert Nagy
cc7cec25c5 net: use callback to properly propagate error
The socket will be destroyed upstream through the proper error
flow.

PR-URL: https://github.com/nodejs/node/pull/29178
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2019-08-19 19:11:12 -07:00
himself65
d53035488c net: shallow copy option when create Server
PR-URL: https://github.com/nodejs/node/pull/28924
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Masashi Hirano <shisama07@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
2019-08-03 21:58:03 -07:00
Rich Trott
3832713fa0 net: replace _writableState.finished with writableFinished
Replace usage of quasi-private _writableState.finished with public
writableFinished property.

PR-URL: https://github.com/nodejs/node/pull/27974
Refs: https://github.com/nodejs/node/issues/445
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2019-06-26 08:14:32 -07:00
Luigi Pinca
714a32c41f net: make writeAfterFIN() return false
If `false` is not returned a readable stream piped into the socket
might continue reading indefinitely until the process goes out of
memory.

PR-URL: https://github.com/nodejs/node/pull/27996
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2019-06-04 06:02:58 +02:00
Joyee Cheung
8d901bb44e
src: move guessHandleType in the util binding
It does not make too much sense to have modules unrelated to TTY
load the TTY binding just to use this method. Put this in the
util binding instead.

PR-URL: https://github.com/nodejs/node/pull/27289
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2019-04-20 13:25:41 +08:00
Joyee Cheung
a38e9c438a
lib: require globals instead of using the global proxy
In addition, use process.stderr instead of console.error when
there is no need to swallow the error.

PR-URL: https://github.com/nodejs/node/pull/27112
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
2019-04-16 04:24:26 +08:00
Michaël Zasso
908292cf1f lib: enforce the use of Object from primordials
PR-URL: https://github.com/nodejs/node/pull/27146
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Gus Caplan <me@gus.host>
2019-04-12 05:38:45 +02:00
Luigi Pinca
655c90b287 net: inline maybeDestroy()
`maybeDestroy()` is only called from the listener of the `'end'` event.
That event is only emitted after the socket is connected (after `UV_EOF`
is read) and after `socket.readable` is set to `false`.

PR-URL: https://github.com/nodejs/node/pull/27136
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2019-04-11 07:53:30 +02:00
cjihrig
bd9109c241
lib: move DEP0021 to end of life
Server.listenFD() has been runtime deprecated since
Node 0.7.12. This commit moves the deprecation to
end-of-life.

PR-URL: https://github.com/nodejs/node/pull/27127
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
2019-04-10 08:25:50 -04:00
Ruben Bridgewater
f86f5736da
benchmark,lib: change var to const
Refs: https://github.com/nodejs/node/pull/26679

PR-URL: https://github.com/nodejs/node/pull/26915
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Refael Ackermann <refack@gmail.com>
2019-03-30 13:16:39 +01:00
dnlup
f0b3855a90
net: remove usage of require('util')
Use `require('internal/util/inspect').inspect`,
`require('internal/util/debuglog').debuglog`,
`require('internal/util').deprecate` and `Object.setPrototypeOf` instead
of `require('util')`.
Fix test in `test/parallel/test-net-access-byteswritten.js` to do not
check the `super_` property that was set when using
`require('util').inherits`.

Refs: https://github.com/nodejs/node/issues/26546
Refs: https://github.com/nodejs/node/pull/26896

PR-URL: https://github.com/nodejs/node/pull/26920
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
2019-03-30 13:13:42 +01:00
Ruben Bridgewater
b08a867d60
benchmark,doc,lib: capitalize more comments
PR-URL: https://github.com/nodejs/node/pull/26849
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com>
2019-03-27 17:20:06 +01:00
cjihrig
5de804e636
tools: enable getter-return lint rule
PR-URL: https://github.com/nodejs/node/pull/26615
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Masashi Hirano <shisama07@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com>
2019-03-25 20:02:10 -04:00
Ruben Bridgewater
96204c3c71
net: do not manipulate potential user code
The error provided in this function could come from user code. Thus
the error should not be manipulated in any way. The added properties
do not seem to provide any actual value either as can not be part
of the error. The `hostname` is already set on the error and adding
the `host` property with the identical value does not seem right in
this case.

PR-URL: https://github.com/nodejs/node/pull/26751
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
2019-03-25 16:13:33 +01:00
Rich Trott
3f41fcbe83 Revert "net: remove usage of require('util')"
This reverts commit e112fb4c22.
This commit broke parallel/test-net-access-byteswritten.

PR-URL: https://github.com/nodejs/node/pull/26896
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com>
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
2019-03-24 19:42:58 -07:00
dnlup
e112fb4c22
net: remove usage of require('util')
Use `require('internal/util/inspect').inspect` and
`require('internal/util/debuglog').debuglog` instead of
`require('util').debuglog` and `require('util').inspect`.

PR-URL: https://github.com/nodejs/node/pull/26807
Refs: https://github.com/nodejs/node/issues/26546
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
2019-03-25 00:35:53 +01:00
Ruben Bridgewater
39f4158bc3
lib: move extra properties into error creation
This encapsulates the Node.js errors more by adding extra properties
to an error inside of the function to create the error message instead
of adding the properties at the call site. That simplifies the usage
of our errors and makes sure the expected properties are always set.

PR-URL: https://github.com/nodejs/node/pull/26752
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2019-03-21 22:52:08 +01:00
oyyd
cd8b7391dc net: some scattered cleanup
This commit cleans up net module, including: 1. remove assigning
`handle.readable` and `handle.writable` 2. documents
`NODE_PENDING_PIPE_INSTANCES` enviroment variable 3. use constants
for '0.0.0.0' and '::'.

PR-URL: https://github.com/nodejs/node/pull/24128
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
2019-03-15 10:26:37 +08:00
James M Snell
f9ddbb6b2f
lib: move DTRACE_* probes out of global scope
The DTRACE_* probes have been global for no really good reason.
Move those into an internalBinding.

PR-URL: https://github.com/nodejs/node/pull/26541
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Matheus Marchini <mat@mmarchini.me>
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
2019-03-12 14:19:36 +00:00
Anna Henningsen
e7f58868b5
net: use kHandle symbol for accessing native handle
Use a common `kHandle` for all `StreamBase`-based streams.

PR-URL: https://github.com/nodejs/node/pull/26491
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Sam Roberts <vieuxtech@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
2019-03-10 00:46:54 +01:00
Ruben Bridgewater
f8763bb077
benchmark,doc,lib,test: capitalize comments
PR-URL: https://github.com/nodejs/node/pull/26483
Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
2019-03-10 00:44:40 +01:00
Ruben Bridgewater
9edce1e12a
benchmark,doc,lib,test: capitalize comments
This updates a lot of comments.

PR-URL: https://github.com/nodejs/node/pull/26223
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com>
Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com>
2019-02-28 18:31:10 +01:00
Rich Trott
62942e9ad7 lib: replace 'assert' with 'internal/assert' for many built-ins
Replace large 'assert' module with tiny 'internal/assert' module for
many built-in uses.

PR-URL: https://github.com/nodejs/node/pull/25956
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Minwoo Jung <minwoo@nodesource.com>
2019-02-08 00:01:12 -08:00
ZYSzys
802ea05a37
net,http2: merge setTimeout code
PR-URL: https://github.com/nodejs/node/pull/25084
Refs: https://github.com/nodejs/node/issues/19060
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2019-01-27 17:20:13 +01:00
Anna Henningsen
2b65399694
http2: allow fully synchronous _final()
HTTP/2 streams do not use the fact that the native
`StreamBase::Shutdown()` is asynchronous by default and
always finish synchronously.

Adding a status code for this scenario allows skipping an
expensive `MakeCallback()` C++/JS boundary crossing.

PR-URL: https://github.com/nodejs/node/pull/25609
Reviewed-By: Sam Roberts <vieuxtech@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2019-01-23 16:32:20 +01:00
Rich Trott
79aab5dd7c
net: use decodeStrings public API for writable stream
Instead of using an undocumented underscore-prefixed property to
configure the writable stream instance to not encode strings as buffers,
use the public API which is an options property passed to the
constructor.

Refs: https://github.com/nodejs/node/issues/445

PR-URL: https://github.com/nodejs/node/pull/25201
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2018-12-26 14:18:55 +01:00
David Halls
86e2ec41af net: check for close on stream, not parent
'close' event isn't emitted on a TLS connection if it's been written to
(but 'end' and 'finish' events are).

PR-URL: https://github.com/nodejs/node/pull/25026
Fixes: https://github.com/nodejs/node/issues/24984
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2018-12-26 08:06:32 +01:00
Ruben Bridgewater
d4c91f2814
lib: remove internal util._extends() usage
This removes all internal calls to the deprecated `_extends()`
function. It is slower than `Object.assign()` and the object spread
notation since V8 6.8 and using the spread notation often also
results in shorter code.

PR-URL: https://github.com/nodejs/node/pull/25105
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2018-12-20 13:52:44 +01:00
Ruben Bridgewater
50dd555910
doc,lib,test: capitalize comment sentences
This activates the eslint capitalize comment rule for comments
above 50 characters.

PR-URL: https://github.com/nodejs/node/pull/24996
Reviewed-By: Ujjwal Sharma <usharma1998@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2018-12-17 17:14:35 +01:00
cjihrig
06134e3598
net: use strict comparisons for fd
This commit removes an eslint-disable comment, and moves file
descriptor checks to use strict equality. These checks were
using loose equality to support numeric and string file
descriptors. However, d9e95d8982
introduced strict validation, making the loose equality checks
redundant.

PR-URL: https://github.com/nodejs/node/pull/25014
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2018-12-15 12:16:42 -05:00
Ruben Bridgewater
1f85ea979c
tools: capitalize sentences
This adds the `capitalized-comments` eslint rule to verify that
actual sentences use capital letters as starting letters. It ignores
special words and all lines below 62 characters.

PR-URL: https://github.com/nodejs/node/pull/24808
Reviewed-By: Sam Ruby <rubys@intertwingly.net>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Ujjwal Sharma <usharma1998@gmail.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
2018-12-10 17:07:18 +01:00
Gus Caplan
366aaf57fa lib: remove some useless assignments
PR-URL: https://github.com/nodejs/node/pull/23199
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
2018-12-05 15:57:26 -08:00
Ruben Bridgewater
59257543c3
lib: use ES6 class inheritance style
PR-URL: https://github.com/nodejs/node/pull/24755
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2018-12-05 16:55:00 +01:00
Ruben Bridgewater
dcc82b37b6
lib: remove inherits() usage
This switches all `util.inherits()` calls to use
`Object.setPrototypeOf()` instead. In fact, `util.inherits()` is
mainly a small wrapper around exactly this function while adding
the `_super` property on the object as well.

Refs: #24395

PR-URL: https://github.com/nodejs/node/pull/24755
Refs: https://github.com/nodejs/node/issues/24395
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2018-12-05 16:53:58 +01:00
Ouyang Yadong
9389b464ea net: emit "write after end" errors in the next tick
This commit makes those errors caused by calling
`net.Socket.write()` after sockets ending be emitted in the next
tick.

PR-URL: https://github.com/nodejs/node/pull/24457
Fixes: https://github.com/nodejs/node/issues/24111
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2018-11-24 23:46:02 -08:00
Ouyang Yadong
33a25b29a4 net,dgram: add ipv6Only option for net and dgram
For TCP servers, the dual-stack support is enable by default, i.e.
binding host "::" will also make "0.0.0.0" bound. This commit add
ipv6Only option in `net.Server.listen()` and `dgram.createSocket()`
methods which allows to disable dual-stack support. Support for
cluster module is also provided in this commit.

Fixes: https://github.com/nodejs/node/issues/17664

PR-URL: https://github.com/nodejs/node/pull/23798
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
2018-11-22 21:45:08 +08:00
Anna Henningsen
8dd8b8fad9 net,http2: merge after-write code
PR-URL: https://github.com/nodejs/node/pull/24380
Refs: https://github.com/nodejs/node/issues/19060
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
2018-11-21 09:53:49 +01:00
Anna Henningsen
8cdb92f11c
Revert "net: partially revert "simplify Socket.prototype._final""
This reverts commit ac1f56c76a.

Refs: https://github.com/nodejs/node/pull/24288
Refs: https://github.com/nodejs/node/pull/24075

PR-URL: https://github.com/nodejs/node/pull/24290
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Reviewed-By: Ouyang Yadong <oyydoibh@gmail.com>
2018-11-16 10:09:42 +01:00