Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dgram: refactor dgram to module.exports #11696

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions lib/dgram.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ function newHandle(type) {
}


exports._createSocketHandle = function(address, port, addressType, fd, flags) {
function _createSocketHandle(address, port, addressType, fd, flags) {
// Opening an existing fd is not supported for UDP handles.
assert(typeof fd !== 'number' || fd < 0);

Expand All @@ -72,7 +72,7 @@ exports._createSocketHandle = function(address, port, addressType, fd, flags) {
}

return handle;
};
}


function Socket(type, listener) {
Expand All @@ -99,12 +99,11 @@ function Socket(type, listener) {
this.on('message', listener);
}
util.inherits(Socket, EventEmitter);
exports.Socket = Socket;


exports.createSocket = function(type, listener) {
function createSocket(type, listener) {
return new Socket(type, listener);
};
}


function startListening(socket) {
Expand Down Expand Up @@ -585,3 +584,9 @@ Socket.prototype.unref = function() {

return this;
};

module.exports = {
_createSocketHandle,
createSocket,
Socket
};