dgram: remove unnecessary fd property from Socket

It seems the property socket.fd is used long before for the
compatibility reason but it's not used anymore. It's also
not documented in docs so that it's not a public api/property.
Keep the property also make the code a bit confusing as
socket._handle.fd is the actual property representing fd.

PR-URL: https://github.com/nodejs/node/pull/21684
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Minwoo Jung <minwoo@nodesource.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Jon Moss <me@jonathanmoss.me>
This commit is contained in:
Ouyang Yadong 2018-08-10 10:51:24 +08:00 committed by Jon Moss
parent 7b1f3a4133
commit 3ce6bc3b50

View File

@ -85,7 +85,6 @@ function Socket(type, listener) {
this[async_id_symbol] = handle.getAsyncId();
this.type = type;
this.fd = null; // compatibility hack
if (typeof listener === 'function')
this.on('message', listener);
@ -116,7 +115,6 @@ function startListening(socket) {
state.handle.recvStart();
state.receiving = true;
state.bindState = BIND_STATE_BOUND;
socket.fd = -42; // compatibility hack
if (state.recvBufferSize)
bufferSize(socket, state.recvBufferSize, RECV_BUFFER);
@ -677,7 +675,6 @@ function stopReceiving(socket) {
state.handle.recvStop();
state.receiving = false;
socket.fd = null; // compatibility hack
}