dgram: tracking unrefdness of dgram sockets#5828
dgram: tracking unrefdness of dgram sockets#5828thlorenz wants to merge 2 commits intonodejs:masterfrom
Conversation
- initializing `_unref` to `false` when the socket is created - updating that value each time either `unref()` or `ref()` is invoked on it - this mirrors the implementation in `lib/net.js` - adding test to check unrefdness tracking
|
I'm curious, why add this and the |
|
@mscdex This is useful for tools that show pending async actions in the process and need to show if they are keeping the process running or not. |
|
LGTM. Again, would substitute |
|
@cjihrig as in |
|
Yes, like that. I think it's a little more readable, with the state toggling back and forth. |
|
Been thinking about this sort of thing for a while, I think it would be best for every handle to have this sort of property in c++, accessible to JS, if possible. |
- using strictEquals for tests
|
@Fishrock123 until then we should still get this in IMO, so we are aligned with the info that's exposed by |
|
@thlorenz Problem is, we might not be able to remove the |
|
@Fishrock123 that is a valid concern, but the same is true for |
|
-1. If it's useful, it should be public |
|
I think I am -1 on this as well. We should not be adding underscore-prefixed properties that we are encouraging end users to use as public/documented properties. Either don't add it at all or remove the underscore and document it. |
Agreed, just trying to match the implementation in |
This allows third-party tools to check whether or not a handle that can be unreferenced is unreferenced at a particular time. Notably, this should be helpful for inspection via AsyncWrap. Also, this is useful even to node's internals, particularly timers. Refs: nodejs#5828 Refs: nodejs#5827 PR-URL: nodejs#5834 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Trevor Norris <trev.norris@gmail.com>
|
@nodejs/ctc ... we've had one LGTM and a couple -1's on this. Can we get additional review? |
|
Not sure, @Fishrock123 ? |
|
-1, sorry |
|
Given the -1's and the discussion, then, I'm closing this. Can reopen if necessary. |
This allows third-party tools to check whether or not a handle that can be unreferenced is unreferenced at a particular time. Notably, this should be helpful for inspection via AsyncWrap. Also, this is useful even to node's internals, particularly timers. Refs: #5828 Refs: #5827 PR-URL: #5834 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Trevor Norris <trev.norris@gmail.com>
Affected core subsystem
dgram
Description of change
_unreftofalsewhen the socket is createdunref()orref()is invokedon it
lib/net.jsThis PR goes together with the same change applied to child_process ( #5827 )
R= @Fishrock123
R= @trevnorris