Make ZMQ interoperate with ZMQ 2.x SUB sockets

Since ZMQ 2.x does not support subscription forwarding, it's not
possible to use ZMQ 2.x SUB socket to receive messages from a PUB
socket.

This patch adds some compatibility layer so that ZMQ 2.x SUB socket
receives messages from PUB socket.
This commit is contained in:
Martin Hurton
2012-09-02 18:19:15 +02:00
parent dfc0222ee6
commit d9307c9ff0
2 changed files with 37 additions and 1 deletions

View File

@@ -26,6 +26,7 @@
#include "fd.hpp"
#include "i_engine.hpp"
#include "i_msg_sink.hpp"
#include "io_object.hpp"
#include "encoder.hpp"
#include "decoder.hpp"
@@ -41,7 +42,7 @@ namespace zmq
// This engine handles any socket with SOCK_STREAM semantics,
// e.g. TCP socket or an UNIX domain socket.
class stream_engine_t : public io_object_t, public i_engine
class stream_engine_t : public io_object_t, public i_engine, public i_msg_sink
{
public:
@@ -55,6 +56,9 @@ namespace zmq
void activate_in ();
void activate_out ();
// i_msg_sink interface implementation.
virtual int push_msg (msg_t *msg_);
// i_poll_events interface implementation.
void in_event ();
void out_event ();