lestrrat-p5 / ZMQ

libzmq Perl binding
46 stars 31 forks source link

zmq_disconnect(): Socket operation on non-socket #59

Closed potatogim closed 10 years ago

potatogim commented 10 years ago

Hi,

I have tried to use zmq_disconnect on LibZMQ3 but I encountered the error "Socket operation on non-socket" msg.

and then I have found the cause of that.

diff -urN ZMQ-LibZMQ3/xs/perl_libzmq3.xs ZMQ-LibZMQ3_new/xs/perl_libzmq3.xs
--- ZMQ-LibZMQ3/xs/perl_libzmq3.xs      2014-06-18 19:25:43.000000000 +0900
+++ ZMQ-LibZMQ3_new/xs/perl_libzmq3.xs  2014-07-08 11:47:50.793955524 +0900
@@ -758,7 +758,7 @@
         const char *addr;
     CODE:
 #ifdef HAS_ZMQ_DISCONNECT
-        RETVAL = zmq_disconnect(socket, addr);
+        RETVAL = zmq_disconnect(socket->socket, addr);
         if (RETVAL != 0) {
             SET_BANG;
         }
@@ -792,7 +792,7 @@
         const char *addr;
     CODE:
 #ifdef HAS_ZMQ_UNBIND
-        RETVAL = zmq_unbind(socket, addr);
+        RETVAL = zmq_unbind(socket->socket, addr);
         if (RETVAL == -1) {
             SET_BANG;
         }
@@ -1175,7 +1175,7 @@
         int events;
     CODE:
 #ifdef HAS_ZMQ_SOCKET_MONITOR
-        RETVAL = zmq_socket_monitor(socket, addr, events);
+        RETVAL = zmq_socket_monitor(socket->socket, addr, events);
         if (RETVAL != 0) {
             SET_BANG;
         }

After apply this patch, zmq_disconnect() function do that correctly.

I am grateful for being able to use this package.

Have a nice day!

potatogim commented 10 years ago

Oh, zmq_unbind(), zmq_socket_monitor() is the same.

I have attached the diff output for fixing this bugs.

luzluna commented 10 years ago

i think so..

lestrrat commented 10 years ago

heh, odd. it looks like it's been like that for ages and nobody told me about it :/

lestrrat commented 10 years ago

Oh nevermind, that's a regression introduced by some other patch. I see where it came from.