Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

net: socket options ignored before connect #8572

Closed
mscdex opened this issue Oct 17, 2014 · 6 comments
Closed

net: socket options ignored before connect #8572

mscdex opened this issue Oct 17, 2014 · 6 comments

Comments

@mscdex
Copy link

mscdex commented Oct 17, 2014

Currently if you try setting socket options (e.g. via socket.setKeepAlive()) on a new TCP socket before calling socket.connect(), the arguments are silently ignored.

To avoid confusion about this I suggest two separate solutions:

  • Throw an error if no handle is created yet
  • Save the arguments on the socket object for applying after a handle is created
@mscdex mscdex changed the title net: cannot set socket options before connect net: socket options ignored before connect Oct 17, 2014
@vkurchatkin
Copy link

related: #7077

@trevnorris trevnorris added the net label Dec 30, 2014
evanlucas added a commit to evanlucas/node that referenced this issue Feb 19, 2015
Remembers net.Socket options called before connect and retroactively
applies them after the handle has been created.

This change makes the following function calls more user-friendly:

- setKeepAlive()
- setNoDelay()
- ref()
- unref()

Related: nodejs/node-v0.x-archive#7077 and
nodejs/node-v0.x-archive#8572
evanlucas added a commit to evanlucas/node that referenced this issue Feb 20, 2015
Remembers net.Socket options called before connect and retroactively
applies them after the handle has been created.

This change makes the following function calls more user-friendly:

- setKeepAlive()
- setNoDelay()
- ref()
- unref()

Related: nodejs/node-v0.x-archive#7077 and
nodejs/node-v0.x-archive#8572
evanlucas added a commit to evanlucas/node that referenced this issue Feb 20, 2015
Remembers net.Socket options called before connect and retroactively
applies them after the handle has been created.

This change makes the following function calls more user-friendly:

- setKeepAlive()
- setNoDelay()
- ref()
- unref()

Related: nodejs/node-v0.x-archive#7077 and
nodejs/node-v0.x-archive#8572
evanlucas added a commit to evanlucas/node that referenced this issue Feb 23, 2015
Remembers net.Socket options called before connect and retroactively
applies them after the handle has been created.

This change makes the following function calls more user-friendly:

- setKeepAlive()
- setNoDelay()
- ref()
- unref()

Related: nodejs/node-v0.x-archive#7077 and
nodejs/node-v0.x-archive#8572
evanlucas added a commit to evanlucas/node that referenced this issue Mar 19, 2015
Remembers net.Socket options called before connect and retroactively
applies them after the handle has been created.

This change makes the following function calls more user-friendly:

- setKeepAlive()
- setNoDelay()
- ref()
- unref()

Related: nodejs/node-v0.x-archive#7077 and
nodejs/node-v0.x-archive#8572
evanlucas added a commit to evanlucas/node that referenced this issue Mar 19, 2015
Remembers net.Socket options called before connect and retroactively
applies them after the handle has been created.

This change makes the following function calls more user-friendly:

- setKeepAlive()
- setNoDelay()
- ref()
- unref()

Related: nodejs/node-v0.x-archive#7077 and
nodejs/node-v0.x-archive#8572
evanlucas added a commit to evanlucas/node that referenced this issue Apr 24, 2015
Remembers net.Socket options called before connect and retroactively
applies them after the handle has been created.

This change makes the following function calls more user-friendly:

- setKeepAlive()
- setNoDelay()
- ref()
- unref()

Related: nodejs/node-v0.x-archive#7077 and
nodejs/node-v0.x-archive#8572
@misterdjules
Copy link

Referencing #21079 which describes the same issue and has some very useful information too.

@misterdjules
Copy link

nodejs/node#1518 seems to be moving towards the right direction, we might be able to backport it soon.

@misterdjules misterdjules added this to the 0.13.1 milestone May 7, 2015
@misterdjules
Copy link

Adding to the 0.13.1 milestone as I would expect it could break v0.10.x and v0.12.x users, but I'm open to other opinions.

evanlucas added a commit to evanlucas/node that referenced this issue May 19, 2015
Remembers net.Socket options called before connect and retroactively
applies them after the handle has been created.

This change makes the following function calls more user-friendly:

- setKeepAlive()
- setNoDelay()
- ref()
- unref()

Related: nodejs/node-v0.x-archive#7077 and
nodejs/node-v0.x-archive#8572
evanlucas added a commit to evanlucas/node that referenced this issue May 19, 2015
Remembers net.Socket options called before connect and retroactively
applies them after the handle has been created.

This change makes the following function calls more user-friendly:

- setKeepAlive()
- setNoDelay()
- ref()
- unref()

Related: nodejs/node-v0.x-archive#7077 and
nodejs/node-v0.x-archive#8572
evanlucas added a commit to evanlucas/node that referenced this issue May 19, 2015
Remembers net.Socket options called before connect and retroactively
applies them after the handle has been created.

This change makes the following function calls more user-friendly:

- setKeepAlive()
- setNoDelay()
- ref()
- unref()

Related: nodejs/node-v0.x-archive#7077 and
nodejs/node-v0.x-archive#8572
evanlucas added a commit to evanlucas/node that referenced this issue May 19, 2015
Remembers net.Socket options called before connect and retroactively
applies them after the handle has been created.

This change makes the following function calls more user-friendly:

- setKeepAlive()
- setNoDelay()
- ref()
- unref()

Related: nodejs/node-v0.x-archive#7077 and
nodejs/node-v0.x-archive#8572
evanlucas added a commit to evanlucas/node that referenced this issue May 19, 2015
Remembers net.Socket options called before connect and retroactively
applies them after the handle has been created.

This change makes the following function calls more user-friendly:

- setKeepAlive()
- setNoDelay()
- ref()
- unref()

Related: nodejs/node-v0.x-archive#7077 and
nodejs/node-v0.x-archive#8572
evanlucas added a commit to nodejs/node that referenced this issue May 19, 2015
Remembers net.Socket options called before connect and retroactively
applies them after the handle has been created.

This change makes the following function calls more user-friendly:

- setKeepAlive()
- setNoDelay()
- ref()
- unref()

Related: nodejs/node-v0.x-archive#7077 and
nodejs/node-v0.x-archive#8572

Fixes: nodejs/node-v0.x-archive#7077
Fixes: nodejs/node-v0.x-archive#8572
PR-URL: #1518
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Roman Reiss <me@silverwind.io>
@cjihrig
Copy link

cjihrig commented May 19, 2015

nodejs/node@85d9983 just landed. It can either be ported, or we can close this and pick up the changes in the converged branch.

andrewdeandrade pushed a commit to andrewdeandrade/node that referenced this issue Jun 3, 2015
Remembers net.Socket options called before connect and retroactively
applies them after the handle has been created.

This change makes the following function calls more user-friendly:

- setKeepAlive()
- setNoDelay()
- ref()
- unref()

Related: nodejs/node-v0.x-archive#7077 and
nodejs/node-v0.x-archive#8572

Fixes: nodejs/node-v0.x-archive#7077
Fixes: nodejs/node-v0.x-archive#8572
PR-URL: nodejs/node#1518
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Roman Reiss <me@silverwind.io>
@brendanashworth
Copy link

This isn't really a "critical bug", so it isn't applicable for a v0.10 backport. Does anyone have strong feelings for backporting to v0.12? It has been a while.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

7 participants