0
0
mirror of https://github.com/nodejs/node.git synced 2024-11-24 12:10:08 +01:00
Commit Graph

15 Commits

Author SHA1 Message Date
Anna Henningsen
76e67e9884
lib: assign missed deprecation code
Refs: https://github.com/nodejs/node/pull/26245

PR-URL: https://github.com/nodejs/node/pull/26492
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2019-03-07 15:48:55 +01:00
Sam Roberts
c7e628f8b3 lib: deprecate _stream_wrap
Its unused by node, and doesn't have a reasonable use outside of node.

See: https://github.com/nodejs/node/pull/25153
See: https://github.com/nodejs/node/pull/16158

PR-URL: https://github.com/nodejs/node/pull/26245
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
2019-03-04 10:27:50 -08:00
Sam Roberts
00944c7cc2 src: use consistent names for JSStream
Its confusing to call a js class with a handle a "Wrap", usually it's
the C++ handle that is called a Wrap (tcp_wrap, tls_wrap, ...). Its
derived from Socket, and makes a JS stream look like a Socket, so call
it that. Also, remove use of lib/_stream_wrap.js so it can be deprecated
some time.

PR-URL: https://github.com/nodejs/node/pull/25153
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
2018-12-28 12:57:46 -08:00
Anna Henningsen
542e94cdce
lib: move _stream_wrap into internals
This makes a subsequent possible deprecation easier.

PR-URL: https://github.com/nodejs/node/pull/16158
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
2017-10-19 18:06:27 +02:00
Weijia Wang
212de3c5ec
lib: use destructuring for some constants
This change is to unify the declaration for constants into using
destructuring on the top-level-module scope, reducing some redundant
code.

PR-URL: https://github.com/nodejs/node/pull/16063
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
2017-10-16 23:34:32 +02:00
James M Snell
58831b2f24 uv: improvements to process.binding('uv')
* ensure that UV_... props are constants
* improve error message ... the error message when passing
  in `err >= 0` to `util._errnoException()` was less than
   useful.
* refine uses of process.binding('uv')

PR-URL: https://github.com/nodejs/node/pull/14933
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2017-08-23 10:51:15 -07:00
Ruben Bridgewater
1b54371c50 stream: use more explicit statements
Using objectMode with stream_wrap has not worked properly
before and would end in an error.
Therefore prohibit the usage of objectMode alltogether.

This also improves the handling performance due to the
cheaper chunk check and by using explicit statements as they
produce better code from the compiler.

PR-URL: https://github.com/nodejs/node/pull/13863
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2017-06-29 18:03:54 +02:00
LAKSHMI SWETHA GOPIREDDY
d2913384aa errors,stream_wrap: use internal/errors.js
PR-URL: https://github.com/nodejs/node/pull/13291
Refs: https://github.com/nodejs/node/issues/11273
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
2017-06-20 19:11:02 +02:00
Benedikt Meurer
55f9c85a05
stream: ensure that instanceof fast-path is hit.
With the new Ignition+TurboFan pipeline, the instanceof fast-path can be
missed if the right-hand side needs a TDZ check, i.e. is const declared
on a surrounding scope. This doesn't apply to Node 8 at this point,
where it's at V8 5.8, but it applies as soon as V8 5.9 rolls. There's
work going on in Ignition (and TurboFan) to optimize those TDZ checks
properly, but those changes will land in V8 6.1, so might not end up in
Node 8.

One way to work-around this in Node core for now is to use var instead
of const for those right-hand sides for instanceof for now, especially
Buffer in case of streams. This is not beautiful, but proper ducktape.
Improves readable-bigread.js by ~23% with Node LKGR.

PR-URL: https://github.com/nodejs/node/pull/13403
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Calvin Metcalf <calvin.metcalf@gmail.com>
2017-06-09 21:44:11 +02:00
James M Snell
910a8998fb stream: avoid using forEach
PR-URL: https://github.com/nodejs/node/pull/11582
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2017-03-17 11:09:10 -07:00
Rich Trott
68ba9aa0fb test,lib,benchmark: match function names
In most cases, named functions match the variable or property to which
they are being assigned. That also seems to be the practice in a series
of PRs currently being evaluated that name currently-anonymous
functions.

This change applies that rule to instances in the code base that don't
comply with that practice.

This will be enforceable with a lint rule once we upgrade to ESLint
3.8.0.

PR-URL: https://github.com/nodejs/node/pull/9113
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
2016-10-19 22:20:27 -07:00
Fedor Indutny
de2fd63612 stream_wrap: error if stream has StringDecoder
If `.setEncoding` was called on input stream - all emitted `data` will
be `String`s instances, not `Buffer`s. This is unacceptable for
`StreamWrap`, and should not lead to the crash.

Fix: https://github.com/nodejs/node/issues/3970
PR-URL: https://github.com/nodejs/node/pull/4031
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2015-12-06 21:55:25 -05:00
Fedor Indutny
9180140231 _stream_wrap: prevent use after free in TLS
Queued write requests should be invoked on handle close, otherwise the
"consumer" might be already destroyed when the write callbacks of the
"consumed" handle will be invoked. Same applies to the shutdown
requests.

Make sure to "move" away socket from server to not break the
`connections` counter in `net.js`. Otherwise it might not call `close`
callback, or call it too early.

Fix: https://github.com/iojs/io.js/issues/1696
PR-URL: https://github.com/nodejs/io.js/pull/1910
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
2015-06-30 20:09:22 -07:00
Brendan Ashworth
c8fa8ccdbc streams: use strict on _stream_wrap
A Mostly Harmless™ change to enable 'use strict' mode in _stream_wrap, bringing it in line with /all/ the other modules.

PR-URL: https://github.com/iojs/io.js/pull/1279
Reviewed-By: Brian White (@mscdex) <mscdex@mscdex.net>
Reviewed-By: Roman Reiss (@silverwind) <me@silverwind.io>
Reviewed-By: Yosuke Furukawa (@yosuke-furukawa)
<yosuke.furukawa@gmail.com>
2015-03-28 04:06:01 +09:00
Fedor Indutny
1738c77835 streams: introduce StreamWrap and JSStream
Introduce a way to wrap plain-js `stream.Duplex` streams into C++
StreamBase's child class. With such method at hand it is now possible to
pass `stream.Duplex` instance as a `socket` parameter to
`tls.connect()`.

PR-URL: https://github.com/iojs/io.js/pull/926
Reviewed-By: Chris Dickinson <christopher.s.dickinson@gmail.com>
2015-02-24 22:38:21 +03:00