Skip to content

Socket.prototype._handle is deprecated warning is caused by MDNS.ts #42

@CMCDragonkai

Description

@CMCDragonkai

Describe the bug

Inside MDNS.ts, it's using _handle in a few places. In particular:

        if (platform === 'linux' && disableLinuxMulticastAllOption) {
          socketUtils.disableSocketMulticastAll(
            (unicastSocket as any)._handle.fd,
          );
        }
          if (platform === 'linux' && disableLinuxMulticastAllOption) {
            socketUtils.disableSocketMulticastAll((socket as any)._handle.fd);
          }

The usage of _handle in the Socket prototype causes warnings.

It looks like this in PK CLI:

(node:500471) [DEP0112] DeprecationWarning: Socket.prototype._handle is deprecated
(Use `node --trace-deprecation ...` to show where the warning was created)

Right after starting the agent.

Find an alternative way to do the above, or we need some way of disabling the warning? This is some sort of internal property right?

Apparently Node allows disabling warnings on startup.

To Reproduce

  1. Run Polykey-CLI polykey agent start
  2. Observe warning in the terminal

Expected behavior

No warnings should occur.

Additional context

Notify maintainers

@amydevs

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions