Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed a bug with PUSH/PULL sockets

  • Loading branch information...
commit f88b03d6c3f1cf07eff0fb9cb11b800daa9738ff 1 parent 884a8d7
@saleyn saleyn authored
Showing with 12 additions and 3 deletions.
  1. +2 −2 include/zmq.hrl
  2. +1 −1  src/Makefile.in
  3. +9 −0 src/zmq.erl
View
4 include/zmq.hrl
@@ -12,8 +12,8 @@
-define('ZMQ_REP', 4).
-define('ZMQ_XREQ', 5).
-define('ZMQ_XREP', 6).
--define('ZMQ_PUSH', 7).
--define('ZMQ_PULL', 8).
+-define('ZMQ_PULL', 7).
+-define('ZMQ_PUSH', 8).
-define('ZMQ_UPSTREAM', 7).
-define('ZMQ_DOWNSTREAM', 8).
View
2  src/Makefile.in
@@ -5,7 +5,7 @@ MKDIR_P=@MKDIR_P@
INSTALL=@INSTALL@
DIST_DIR=@PACKAGE_INSTALL_DIR@
VSN=@PACKAGE_VERSION@
-ERL_FLAGS=@ERL_FLAGS@ -I../include
+ERL_FLAGS=@ERL_FLAGS@ -I../include $(if $(test),-DTEST)
ERL_SOURCES=$(wildcard *.erl)
EBIN_DIR=../ebin
DOC_DIR=../doc
View
9 src/zmq.erl
@@ -596,4 +596,13 @@ setsockopts_test() ->
?assertMatch({ok, false}, zmq:getsockopt(S, active)),
ok.
+pushpull_test() ->
+ zmq:start(),
+ {ok, Push} = zmq:socket(push, [{active, false}]),
+ {ok, Pull} = zmq:socket(pull, [{active, false}]),
+ ?assertMatch(ok, zmq:bind(Pull,"tcp://127.0.0.1:2000")),
+ ?assertMatch(ok, zmq:connect(Push, "tcp://127.0.0.1:2000")),
+ ?assertMatch(ok, zmq:send(Push, <<"Hello World!">>)),
+ ?assertMatch({ok, <<"Hello World!">>}, zmq:recv(Pull)).
+
-endif.
Please sign in to comment.
Something went wrong with that request. Please try again.