Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
dgram: changes Socket.close() to return itself
This commit adds a return statement to the dgram.Socket.close()
function that returns itself after it finishes. This follows along
the functionality of the more popular and, dare I say, father-library
`lib/net.js`.
  • Loading branch information
brendanashworth committed Dec 29, 2014
commit 6a2f4b5325bb8173fab302ece511819071060081
2 changes: 2 additions & 0 deletions lib/dgram.js
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,8 @@ Socket.prototype.close = function() {
this._handle.close();
this._handle = null;
this.emit('close');

return this;
};


Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-dgram-close.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ buf.fill(42);
var socket = dgram.createSocket('udp4');
var handle = socket._handle;
socket.send(buf, 0, buf.length, common.PORT, 'localhost');
socket.close();
assert.strictEqual(socket.close(), socket);
socket = null;

// Verify that accessing handle after closure doesn't throw
Expand Down