mirror of
https://github.com/S2-/minifyfromhtml.git
synced 2025-08-03 04:10:04 +02:00
update node modules
This commit is contained in:
14
node_modules/ws/lib/stream.js
generated
vendored
14
node_modules/ws/lib/stream.js
generated
vendored
@@ -48,6 +48,7 @@ function duplexOnError(err) {
|
||||
*/
|
||||
function createWebSocketStream(ws, options) {
|
||||
let resumeOnReceiverDrain = true;
|
||||
let terminateOnDestroy = true;
|
||||
|
||||
function receiverOnDrain() {
|
||||
if (resumeOnReceiverDrain) ws._socket.resume();
|
||||
@@ -81,6 +82,16 @@ function createWebSocketStream(ws, options) {
|
||||
ws.once('error', function error(err) {
|
||||
if (duplex.destroyed) return;
|
||||
|
||||
// Prevent `ws.terminate()` from being called by `duplex._destroy()`.
|
||||
//
|
||||
// - If the state of the `WebSocket` connection is `CONNECTING`,
|
||||
// `ws.terminate()` is a noop as no socket was assigned.
|
||||
// - Otherwise, the error was re-emitted from the listener of the `'error'`
|
||||
// event of the `Receiver` object. The listener already closes the
|
||||
// connection by calling `ws.close()`. This allows a close frame to be
|
||||
// sent to the other peer. If `ws.terminate()` is called right after this,
|
||||
// the close frame might not be sent.
|
||||
terminateOnDestroy = false;
|
||||
duplex.destroy(err);
|
||||
});
|
||||
|
||||
@@ -108,7 +119,8 @@ function createWebSocketStream(ws, options) {
|
||||
if (!called) callback(err);
|
||||
process.nextTick(emitClose, duplex);
|
||||
});
|
||||
ws.terminate();
|
||||
|
||||
if (terminateOnDestroy) ws.terminate();
|
||||
};
|
||||
|
||||
duplex._final = function (callback) {
|
||||
|
Reference in New Issue
Block a user