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

net: make Server.prototype.unref() persistent #8966

Closed
wants to merge 1 commit into from
Closed

net: make Server.prototype.unref() persistent #8966

wants to merge 1 commit into from

Conversation

cjihrig
Copy link

@cjihrig cjihrig commented Jan 3, 2015

Currently, the unref() method does not remember any state if called before the server's handle has been created. This commit adds state to track calls to ref() and unref().

Related to #7077. Note - a similar fix is possible for Socket.prototype.unref() (which I have code for). However, Socket appears to have additional unref() issues other than persistence.

Currently, the unref() method does not remember any state
if called before the server's handle has been created. This
commit adds state to track calls to ref() and unref().
@tjfontaine
Copy link

This looks like it should be targeted at v0.10 as a bug fix, are there other places this is true -- for instance in dgram?

@cjihrig
Copy link
Author

cjihrig commented Jan 29, 2015

Closing in favor of #9115.

@tjfontaine Regarding dgram - the following code prints 'bound' and then exits. Removing the unref() causes the program to not exit.

var dgram = require('dgram');
var socket = dgram.createSocket('udp4');

socket.unref();
socket.bind(8000, function() {
  console.log('bound');
});

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

Successfully merging this pull request may close these issues.

4 participants