Please use this template for reporting suspected bugs or requests for help.
Issue description
Calling zmq_disconnect with a uri="tcp://*:5555" does not remove the multimap _endpoints in socket_base.hpp
Environment
Visual Studio Community 2022
libzmq version (commit hash if unreleased): 4.3.4 but the offending code appears to be unchanged in main branch.
OS: Windows 11
Minimal test code / Steps to reproduce the issue
Run the following in a debugger.
#include "zmq.h"
int main (void)
{
void *context = zmq_ctx_new ();
void *server = zmq_socket (context, ZMQ_REP);
zmq_bind (server, "tcp://*:5555");
// Next line returns ENOENT from line 1208
// of socketbase.cpp
zmq_disconnect(server,"tcp://*:5555");
zmq_close (server);
zmq_ctx_destroy (context);
return 0;
}
What's the actual result? (include assertion message & call stack if applicable)
Line 1209 of socketbase.cpp returns after setting an error thus preventing
follow on code from removing the endpoint from the map.
What's the expected result?
In the case where range.first==range.second, socketbase.cpp
1) Sees if the uri is in the _endpoints minimap
2) if so, attempts to terminate it
3) erases it from the _endpoints map
4) sets _disconnected to true
5) return 0 with no error set
Note
I originally question whether or not it was a valid URI. Given that it is used in the guide https://zguide.zeromq.org/docs/chapter4/ and actually works up to the point you try and disconnect, I came to the conclusion it is. Of course I could be mistaken in which case, the bug is not that it doesn't properly disconnect but it allows a connection and the docs need updated.
Please use this template for reporting suspected bugs or requests for help.
Issue description
Calling zmq_disconnect with a
uri="tcp://*:5555"
does not remove the multimap _endpoints insocket_base.hpp
Environment
Visual Studio Community 2022
Minimal test code / Steps to reproduce the issue
What's the actual result? (include assertion message & call stack if applicable)
Line 1209 of socketbase.cpp returns after setting an error thus preventing follow on code from removing the endpoint from the map.
What's the expected result?
In the case where range.first==range.second,
![image](https://user-images.githubusercontent.com/9875430/216831547-0c18384a-ad14-4b1e-903c-d0938ab29458.png)
socketbase.cpp
1) Sees if the uri is in the _endpoints minimap 2) if so, attempts to terminate it 3) erases it from the _endpoints map 4) sets _disconnected to true 5) return 0 with no error setNote
I originally question whether or not it was a valid URI. Given that it is used in the guide https://zguide.zeromq.org/docs/chapter4/ and actually works up to the point you try and disconnect, I came to the conclusion it is. Of course I could be mistaken in which case, the bug is not that it doesn't properly disconnect but it allows a connection and the docs need updated.