GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — dgram: return self on .bind() and .close() by brendanashworth · Pull Request #214 · nodejs/node

Conversation

@brendanashworth

@brendanashworth brendanashworth commented Dec 29, 2014

Copy link
Copy Markdown
Contributor

These commits add two functionalities to the lib/dgram.js library: a datagram Socket should return itself when it is both closed and bound to a host.

This can be used for better chaining of functions, i.e.:

var socket = dgram.createSocket('udp4').bind(1234);

I ran across this when I was working with the datagram module and chained it like above ^, expecting it to behave like the net module does. These two commits basically make it function like the net module now.

> var net = require('net'); var dgram = require('dgram');
undefined
> var server = net.createServer(function() {});
undefined
> var socket = dgram.createSocket('udp4');
undefined
> server.listen(8124) == server;
true
> socket.bind(8124) == socket;
false

I also added tests, I hope those tests are satisfactory, and should this be merged into io.js I'll send a PR into node.js.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@bnoordhuis

bnoordhuis commented Dec 29, 2014

Copy link
Copy Markdown
Member

LGTM but can you make the commit log conform to the convention? See CONTRIBUTING.md or git log lib/dgram.js for examples.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

brendanashworth added 2 commits December 29, 2014 13:38
@brendanashworth
dgram: change Socket.bind() to return itself
57332c0
This commit changes `lib/dgram.js` Sockets to, when
they are bound to a port / IP, return themselves. This
is done in order to allow chaining of methods and be
in accordance with the `lib/net.js` library.
@brendanashworth
dgram: changes Socket.close() to return itself
6a2f4b5
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`.
@brendanashworth
brendanashworth force-pushed the dgram-return-self branch from f2207da to 6a2f4b5 Compare December 29, 2014 21:39
@brendanashworth

brendanashworth commented Dec 29, 2014

Copy link
Copy Markdown
Contributor Author

@bnoordhuis I think its fixed!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

bnoordhuis pushed a commit to bnoordhuis/io.js that referenced this pull request Dec 30, 2014
@brendanashworth @bnoordhuis
dgram: change Socket.bind() to return itself
3e0057d
This commit changes `lib/dgram.js` Sockets to, when
they are bound to a port / IP, return themselves. This
is done in order to allow chaining of methods and be
in accordance with the `lib/net.js` library.

PR-URL: nodejs#214
Reviewed-By: Ben Noordhuis <[email protected]>
bnoordhuis pushed a commit to bnoordhuis/io.js that referenced this pull request Dec 30, 2014
@brendanashworth @bnoordhuis
dgram: changes Socket.close() to return itself
4444b7b
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`.

PR-URL: nodejs#214
Reviewed-By: Ben Noordhuis <[email protected]>
@bnoordhuis

bnoordhuis commented Dec 30, 2014

Copy link
Copy Markdown
Member

Thanks Brendan, landed in 3e0057d and 4444b7b!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bnoordhuis bnoordhuis closed this Dec 30, 2014
@rvagg rvagg mentioned this pull request Jan 3, 2015
governance: Add new Collaborators #234
Closed
@brendanashworth
brendanashworth deleted the dgram-return-self branch March 8, 2015 20:11
@snyk-bot snyk-bot mentioned this pull request Jan 8, 2020
[Snyk] Upgrade rollup-plugin-node-resolve from 4.0.0 to 4.2.4 timscharfenort/node#5
Open
@snyk-bot snyk-bot mentioned this pull request Jul 5, 2020
[Snyk] Upgrade rollup-plugin-node-resolve from 4.0.0 to 4.2.4 sitedata/node#3
Open
@snyk-bot snyk-bot mentioned this pull request Aug 11, 2020
[Snyk] Upgrade rollup-plugin-node-resolve from 4.0.0 to 4.2.4 radiumrasheed/node#3
Open
@snyk-bot snyk-bot mentioned this pull request Aug 27, 2020
[Snyk] Upgrade rollup-plugin-node-resolve from 4.0.0 to 4.2.4 aliceUnhinged613/node#5
Open
@snyk-bot snyk-bot mentioned this pull request Jan 10, 2021
[Snyk] Upgrade rollup-plugin-node-resolve from 4.0.0 to 4.2.4 ryan-ally/node#9
Merged
@trongham trongham mentioned this pull request Feb 25, 2021
[Snyk] Upgrade rollup-plugin-node-resolve from 4.0.0 to 4.2.4 trongham/node#9
Open
@snyk-bot snyk-bot mentioned this pull request Jun 28, 2021
[Snyk] Upgrade rollup-plugin-node-resolve from 4.0.0 to 4.2.4 ramonbrugman/node#13
Open
@snyk-bot snyk-bot mentioned this pull request Aug 11, 2021
[Snyk] Upgrade rollup-plugin-node-resolve from 4.0.0 to 4.2.4 Andrea-MariaDB-2/node#9
Open
This was referenced Sep 23, 2021
[Snyk] Upgrade rollup-plugin-node-resolve from 4.0.0 to 4.2.4 PinkDiamond1/node#10
Open
[Snyk] Upgrade rollup-plugin-node-resolve from 4.0.0 to 4.2.4 yotamselementor/node#11
Open
@snyk-bot snyk-bot mentioned this pull request Nov 14, 2021
[Snyk] Upgrade rollup-plugin-node-resolve from 4.0.0 to 4.2.4 Mhmonicox/node#5
Open
@snyk-bot snyk-bot mentioned this pull request Dec 21, 2021
[Snyk] Upgrade rollup-plugin-node-resolve from 4.0.0 to 4.2.4 mrod0101/node#9
Open
This was referenced Jan 12, 2022
[Snyk] Upgrade rollup-plugin-node-resolve from 4.0.0 to 4.2.4 dannybrown13/node#16
Open
[Snyk] Upgrade rollup-plugin-node-resolve from 4.0.0 to 4.2.4 blackkhawkk/node#8
Open
@snyk-bot snyk-bot mentioned this pull request Feb 1, 2022
[Snyk] Upgrade rollup-plugin-node-resolve from 4.0.0 to 4.2.4 BryanLaura/node#19
Open
@snyk-bot snyk-bot mentioned this pull request Feb 23, 2022
[Snyk] Upgrade rollup-plugin-node-resolve from 4.0.0 to 4.2.4 NOUIY/node#73
Open
@snyk-bot snyk-bot mentioned this pull request Mar 9, 2022
[Snyk] Upgrade rollup-plugin-node-resolve from 4.0.0 to 4.2.4 RickAllMighty8195/node#10
Open
@snyk-bot snyk-bot mentioned this pull request Mar 25, 2022
[Snyk] Upgrade rollup-plugin-node-resolve from 4.0.0 to 4.2.4 lamjay2704/node#9
Open
@snyk-bot snyk-bot mentioned this pull request Jul 19, 2022
[Snyk] Upgrade rollup-plugin-node-resolve from 4.0.0 to 4.2.4 jgowdy/node#5
Open
@olegnn olegnn mentioned this pull request Nov 30, 2023
[Snyk] Fix for 1 vulnerabilities olegnn/node#48
Open
@RoeeOren RoeeOren mentioned this pull request Nov 30, 2023
[Snyk] Fix for 1 vulnerabilities RoeeOren/node#43
Open
@GregorFendt GregorFendt mentioned this pull request Nov 30, 2023
[Snyk] Fix for 1 vulnerabilities GregorFendt/node#29
Open
@timzwit timzwit mentioned this pull request Nov 30, 2023
[Snyk] Fix for 1 vulnerabilities timzwit/node#34
Open
@aliceUnhinged613 aliceUnhinged613 mentioned this pull request Nov 30, 2023
[Snyk] Fix for 1 vulnerabilities aliceUnhinged613/node#102
Open
@KamilPolivka KamilPolivka mentioned this pull request Nov 30, 2023
[Snyk] Fix for 1 vulnerabilities KamilPolivka/node#31
Open
@137717unity 137717unity mentioned this pull request Nov 30, 2023
[Snyk] Fix for 1 vulnerabilities 137717unity/node#110
Open
@bumplzz69 bumplzz69 mentioned this pull request Nov 30, 2023
[Snyk] Fix for 1 vulnerabilities bumplzz69/node#57
Open
@molllyn1 molllyn1 mentioned this pull request Nov 30, 2023
[Snyk] Fix for 1 vulnerabilities molllyn1/node#91
Open
@awaisab172 awaisab172 mentioned this pull request Nov 30, 2023
[Snyk] Fix for 1 vulnerabilities awaisab172/node#50
Open
@saurabharch saurabharch mentioned this pull request Nov 30, 2023
[Snyk] Fix for 1 vulnerabilities saurabharch/node#35
Open
@sirinartk sirinartk mentioned this pull request Dec 1, 2023
[Snyk] Fix for 1 vulnerabilities sirinartk/node#49
Open
@Verdinjoshua26 Verdinjoshua26 mentioned this pull request Dec 1, 2023
[Snyk] Fix for 1 vulnerabilities Verdinjoshua26/node#54
Open
@Bhanditz Bhanditz mentioned this pull request Dec 1, 2023
[Snyk] Fix for 1 vulnerabilities Bhanditz/node#36
Open
@adamlaska adamlaska mentioned this pull request Dec 1, 2023
[Snyk] Fix for 1 vulnerabilities adamlaska/node#129
Open
@Redwoodtj Redwoodtj mentioned this pull request Dec 1, 2023
[Snyk] Fix for 1 vulnerabilities Redwoodtj/node#11
Open
@wedataintelligence wedataintelligence mentioned this pull request Dec 1, 2023
[Snyk] Fix for 1 vulnerabilities wedataintelligence/node#93
Open
@adamlaska adamlaska mentioned this pull request Dec 1, 2023
[Snyk] Fix for 1 vulnerabilities adamlaska/node#131
Open
@ajesse11x ajesse11x mentioned this pull request Dec 1, 2023
[Snyk] Fix for 1 vulnerabilities ajesse11x/node#46
Open
@aravindb26 aravindb26 mentioned this pull request Jan 4, 2024
[Snyk] Upgrade rollup-plugin-node-resolve from 4.0.0 to 4.2.4 aravindb26/node#1
Open
@CxsLucyfer CxsLucyfer mentioned this pull request Jan 29, 2024
[Snyk] Upgrade rollup-plugin-node-resolve from 4.0.0 to 4.2.4 CxsLucyfer/node#1
Open
@ahamedislam ahamedislam mentioned this pull request Feb 22, 2024
[Snyk] Upgrade rollup-plugin-node-resolve from 4.0.0 to 4.2.4 ahamedislam/node#1
Open
@DanyRay420 DanyRay420 mentioned this pull request Feb 24, 2024
[Snyk] Upgrade rollup-plugin-node-resolve from 4.0.0 to 4.2.4 DanyRay420/node#2
Open
@matrix-compute matrix-compute mentioned this pull request Mar 28, 2024
[Snyk] Upgrade rollup-plugin-node-resolve from 4.0.0 to 4.2.4 matrix-compute/node.js#2
Open
@ashly1111111 ashly1111111 mentioned this pull request Mar 29, 2024
[Snyk] Upgrade rollup-plugin-node-resolve from 4.0.0 to 4.2.4 ashly1111111/node#94
Open
@lairortega lairortega mentioned this pull request Apr 14, 2024
[Snyk] Upgrade rollup-plugin-node-resolve from 4.0.0 to 4.2.4 lairortega/node#1
Open
@yaseenaljamal yaseenaljamal mentioned this pull request Apr 25, 2024
[Snyk] Upgrade rollup-plugin-node-resolve from 4.0.0 to 4.2.4 yaseenaljamal/node#5
Open
@dannybrown13 dannybrown13 mentioned this pull request May 7, 2024
[Snyk] Upgrade rollup-plugin-node-resolve from 4.0.0 to 4.2.4 dannybrown13/node#93
Open
@CharliesAngel1 CharliesAngel1 mentioned this pull request May 7, 2024
[Snyk] Upgrade rollup-plugin-node-resolve from 4.0.0 to 4.2.4 CharliesAngel1/node#14
Open
@snyk-io snyk-io Bot mentioned this pull request May 21, 2024
[Snyk] Upgrade rollup-plugin-node-resolve from 4.0.0 to 4.2.4 Hawthorne001/node2#2
Open
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@brendanashworth @bnoordhuis
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.