libzmq icon indicating copy to clipboard operation
libzmq copied to clipboard

Calling unbind() on a UDP DISH always returns ENOENT, unconditionally.

Open stitch3210 opened this issue 1 year ago • 0 comments

Please use this template for reporting suspected bugs or requests for help.

Issue description

Calling unbind on a UDP DISH returns ENOENT under all circumstances.

Probable cause, see endpoint.hpp:

    const std::string &identifier () const
    {
        return local_type == endpoint_type_bind ? local : remote;
    }

UDP sockets are endpoint_type_none and therefore, identifier() will return the remote address, which can't exist. Change to return local_type != endpoint_type_connect ? local : remote; should fix this, I assume.

  • libzmq version (commit hash if unreleased): 4.3.5
  • OS: Tested on Windows

Minimal test code / Steps to reproduce the issue

zmq::socket_t socket(context, ZMQ_DISH);
socket.bind("udp://*:5555");
socket.unbind("udp://*:5555"); // BANG, same with "udp://0.0.0.0:5555"

What's the actual result? (include assertion message & call stack if applicable)

Socket doesn't get unbound, instead unbind() returns ENOENT

What's the expected result?

Unbound socket, silence, peace, zen...

stitch3210 avatar Aug 19 '24 21:08 stitch3210