[zeromq-dev] zmq_device

Jon Dyte jon at totient.co.uk
Fri Apr 2 00:29:01 CEST 2010


whoops needs this patch as well.

 From a8bd46836785dd14efa5bc4a8a3e1305449cf547 Mon Sep 17 00:00:00 2001
From: Jon Dyte <jon at totient.co.uk>
Date: Thu, 1 Apr 2010 23:24:39 +0100
Subject: [PATCH 8/8] invert test fix

---
 src/forwarder_device.hpp |    2 +-
 src/queue_device.hpp     |    4 ++--
 src/streamer_device.hpp  |    2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/forwarder_device.hpp b/src/forwarder_device.hpp
index 63d9358..80b5e17 100644
--- a/src/forwarder_device.hpp
+++ b/src/forwarder_device.hpp
@@ -38,7 +38,7 @@ namespace zmq
     {
       zmq_msg_t msg;
       int rc = zmq_msg_init(&msg);
-      if (!rc)
+      if (rc)
     return;
       while (true) {
         insocket->recv (&msg,0);
diff --git a/src/queue_device.hpp b/src/queue_device.hpp
index ab83b39..c01b291 100644
--- a/src/queue_device.hpp
+++ b/src/queue_device.hpp
@@ -51,10 +51,10 @@ namespace zmq
     virtual void run()
     {
       int rc = zmq_msg_init(&request_msg);
-      if (!rc)
+      if (rc)
     return;
       rc = zmq_msg_init(&response_msg);
-      if (!rc)
+      if (rc)
     return;
 
       while (true) {
diff --git a/src/streamer_device.hpp b/src/streamer_device.hpp
index c5c1633..e1cabdc 100644
--- a/src/streamer_device.hpp
+++ b/src/streamer_device.hpp
@@ -37,7 +37,7 @@ namespace zmq
     {
       zmq_msg_t msg;
       int rc = zmq_msg_init(&msg);
-      if (!rc)
+      if (rc)
     return;
       while (true) {
         insocket->recv (&msg,0);
-- 
1.6.3.3




Jon Dyte wrote:
> Hi Martin/ Gonzalo/ Brian
>
> As part of the discussion on the list to provide a c api zmq_device so 
> that you could do this :-
>
> int main()
> {
>  void * ctx = zmq_init(1,1,0);
>  void *ear = zmq_socket (ctx, ZMQ_SUB);
>  zmq_bind (ear, "tcp://lo:5001");
>  zmq_setsockopt (ear, ZMQ_SUBSCRIBE, "forex.", 6);
>  void *mouth = zmq_socket (ctx, ZMQ_PUB);
>  zmq_connect (ear, "tcp://127.0.0.1:5001");
>  zmq_device (ZMQ_FORWARDER, ear, mouth);
> }
>
> Please find attached a first cut of this.
>
> There is also a C++ class called device_t which can be used in the C++ 
> space.
>
> It should apply cleanly to the trunk, but needs a few formatting edits 
> to get it into zmq style.
> (I'm also considering renaming some of the classes as they are a bit 
> long)
> (Incidently does any one have a zmq-c-style for emacs?)
>
> It needs testing, so if anyone has a chance, please do.
> I am posting it up now so as to get it reviewed.
>
> Thanks
>
> Jon
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev




More information about the zeromq-dev mailing list