lib: convert to arrow function
PR-URL: https://github.com/nodejs/node/pull/24623 Reviewed-By: Shingo Inoue <leko.noor@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Masashi Hirano <shisama07@gmail.com>
This commit is contained in:
parent
51f07ffc84
commit
b8bd4b454f
@ -68,11 +68,11 @@ const handleConversion = {
|
|||||||
'net.Native': {
|
'net.Native': {
|
||||||
simultaneousAccepts: true,
|
simultaneousAccepts: true,
|
||||||
|
|
||||||
send: function(message, handle, options) {
|
send(message, handle, options) {
|
||||||
return handle;
|
return handle;
|
||||||
},
|
},
|
||||||
|
|
||||||
got: function(message, handle, emit) {
|
got(message, handle, emit) {
|
||||||
emit(handle);
|
emit(handle);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -80,20 +80,20 @@ const handleConversion = {
|
|||||||
'net.Server': {
|
'net.Server': {
|
||||||
simultaneousAccepts: true,
|
simultaneousAccepts: true,
|
||||||
|
|
||||||
send: function(message, server, options) {
|
send(message, server, options) {
|
||||||
return server._handle;
|
return server._handle;
|
||||||
},
|
},
|
||||||
|
|
||||||
got: function(message, handle, emit) {
|
got(message, handle, emit) {
|
||||||
var server = new net.Server();
|
var server = new net.Server();
|
||||||
server.listen(handle, function() {
|
server.listen(handle, () => {
|
||||||
emit(server);
|
emit(server);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
'net.Socket': {
|
'net.Socket': {
|
||||||
send: function(message, socket, options) {
|
send(message, socket, options) {
|
||||||
if (!socket._handle)
|
if (!socket._handle)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -141,7 +141,7 @@ const handleConversion = {
|
|||||||
return handle;
|
return handle;
|
||||||
},
|
},
|
||||||
|
|
||||||
postSend: function(message, handle, options, callback, target) {
|
postSend(message, handle, options, callback, target) {
|
||||||
// Store the handle after successfully sending it, so it can be closed
|
// Store the handle after successfully sending it, so it can be closed
|
||||||
// when the NODE_HANDLE_ACK is received. If the handle could not be sent,
|
// when the NODE_HANDLE_ACK is received. If the handle could not be sent,
|
||||||
// just close it.
|
// just close it.
|
||||||
@ -159,7 +159,7 @@ const handleConversion = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
got: function(message, handle, emit) {
|
got(message, handle, emit) {
|
||||||
var socket = new net.Socket({
|
var socket = new net.Socket({
|
||||||
handle: handle,
|
handle: handle,
|
||||||
readable: true,
|
readable: true,
|
||||||
@ -183,11 +183,11 @@ const handleConversion = {
|
|||||||
'dgram.Native': {
|
'dgram.Native': {
|
||||||
simultaneousAccepts: false,
|
simultaneousAccepts: false,
|
||||||
|
|
||||||
send: function(message, handle, options) {
|
send(message, handle, options) {
|
||||||
return handle;
|
return handle;
|
||||||
},
|
},
|
||||||
|
|
||||||
got: function(message, handle, emit) {
|
got(message, handle, emit) {
|
||||||
emit(handle);
|
emit(handle);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -195,16 +195,16 @@ const handleConversion = {
|
|||||||
'dgram.Socket': {
|
'dgram.Socket': {
|
||||||
simultaneousAccepts: false,
|
simultaneousAccepts: false,
|
||||||
|
|
||||||
send: function(message, socket, options) {
|
send(message, socket, options) {
|
||||||
message.dgramType = socket.type;
|
message.dgramType = socket.type;
|
||||||
|
|
||||||
return socket[kStateSymbol].handle;
|
return socket[kStateSymbol].handle;
|
||||||
},
|
},
|
||||||
|
|
||||||
got: function(message, handle, emit) {
|
got(message, handle, emit) {
|
||||||
var socket = new dgram.Socket(message.dgramType);
|
var socket = new dgram.Socket(message.dgramType);
|
||||||
|
|
||||||
socket.bind(handle, function() {
|
socket.bind(handle, () => {
|
||||||
emit(socket);
|
emit(socket);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -617,7 +617,7 @@ function setupChannel(target, channel) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Convert handle object
|
// Convert handle object
|
||||||
obj.got.call(this, message, handle, function(handle) {
|
obj.got.call(this, message, handle, (handle) => {
|
||||||
handleMessage(message.msg, handle, isInternal(message.msg));
|
handleMessage(message.msg, handle, isInternal(message.msg));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -739,7 +739,7 @@ function setupChannel(target, channel) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (wasAsyncWrite) {
|
if (wasAsyncWrite) {
|
||||||
req.oncomplete = function() {
|
req.oncomplete = () => {
|
||||||
control.unref();
|
control.unref();
|
||||||
if (typeof callback === 'function')
|
if (typeof callback === 'function')
|
||||||
callback(null);
|
callback(null);
|
||||||
@ -876,7 +876,7 @@ function _validateStdio(stdio, sync) {
|
|||||||
|
|
||||||
// Translate stdio into C++-readable form
|
// Translate stdio into C++-readable form
|
||||||
// (i.e. PipeWraps or fds)
|
// (i.e. PipeWraps or fds)
|
||||||
stdio = stdio.reduce(function(acc, stdio, i) {
|
stdio = stdio.reduce((acc, stdio, i) => {
|
||||||
function cleanup() {
|
function cleanup() {
|
||||||
for (var i = 0; i < acc.length; i++) {
|
for (var i = 0; i < acc.length; i++) {
|
||||||
if ((acc[i].type === 'pipe' || acc[i].type === 'ipc') && acc[i].handle)
|
if ((acc[i].type === 'pipe' || acc[i].type === 'ipc') && acc[i].handle)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user