summaryrefslogtreecommitdiff
path: root/src/xrep.hpp
diff options
context:
space:
mode:
authorMartin Sustrik <sustrik@250bpm.com>2011-06-22 11:02:16 +0200
committerMartin Sustrik <sustrik@250bpm.com>2011-06-22 11:02:16 +0200
commitec81f8fb2523e1e2fe45eaadc05311a35bf551d7 (patch)
treee6fbd9b7a789d72678fa02ca06883de15a932beb /src/xrep.hpp
parent10a93bb79fd3d4be1b3ffedfa6785564fbcc082b (diff)
New wire format for REQ/REP pattern
This patch introduces two changes: 1. 32-bit ID is used to identify the peer instead of UUID 2. REQ socket seeds the label stack with unique 32-bit request ID It also drops any replies with non-matching request ID Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
Diffstat (limited to 'src/xrep.hpp')
-rw-r--r--src/xrep.hpp15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/xrep.hpp b/src/xrep.hpp
index fbc7385..d5014e0 100644
--- a/src/xrep.hpp
+++ b/src/xrep.hpp
@@ -25,7 +25,7 @@
#include <vector>
#include "socket_base.hpp"
-#include "blob.hpp"
+#include "stdint.hpp"
#include "msg.hpp"
namespace zmq
@@ -41,7 +41,8 @@ namespace zmq
~xrep_t ();
// Overloads of functions from socket_base_t.
- void xattach_pipe (class pipe_t *pipe_, const blob_t &peer_identity_);
+ void xattach_pipe (class pipe_t *pipe_,
+ const blob_t &peer_identity_);
int xsend (class msg_t *msg_, int flags_);
int xrecv (class msg_t *msg_, int flags_);
bool xhas_in ();
@@ -60,7 +61,7 @@ namespace zmq
struct inpipe_t
{
class pipe_t *pipe;
- blob_t identity;
+ uint32_t peer_id;
bool active;
};
@@ -86,8 +87,8 @@ namespace zmq
bool active;
};
- // Outbound pipes indexed by the peer names.
- typedef std::map <blob_t, outpipe_t> outpipes_t;
+ // Outbound pipes indexed by the peer IDs.
+ typedef std::map <uint32_t, outpipe_t> outpipes_t;
outpipes_t outpipes;
// The pipe we are currently writing to.
@@ -96,6 +97,10 @@ namespace zmq
// If true, more outgoing message parts are expected.
bool more_out;
+ // Peer ID are generated. It's a simple increment and wrap-over
+ // algorithm. This value is the next ID to use (if not used already).
+ uint32_t next_peer_id;
+
xrep_t (const xrep_t&);
const xrep_t &operator = (const xrep_t&);
};