summaryrefslogtreecommitdiff
path: root/src/pgm_receiver.hpp
diff options
context:
space:
mode:
authorMartin Sustrik <sustrik@fastmq.commkdir>2009-09-23 10:23:53 +0200
committerMartin Sustrik <sustrik@fastmq.commkdir>2009-09-23 10:23:53 +0200
commitb0a1a16fc2a84afa0eb2715f680297caef521b54 (patch)
treed95e61336f2a5553c6e4c40a03eb415289ea1092 /src/pgm_receiver.hpp
parent088a2db6746488c1ce4a73c357caaece50bbdf60 (diff)
parent25211307696752acc17e91783aa662dc9e423b21 (diff)
Merge branch 'master' of git@github.com:sustrik/zeromq2
Diffstat (limited to 'src/pgm_receiver.hpp')
-rw-r--r--src/pgm_receiver.hpp37
1 files changed, 24 insertions, 13 deletions
diff --git a/src/pgm_receiver.hpp b/src/pgm_receiver.hpp
index 05b27e2..b573081 100644
--- a/src/pgm_receiver.hpp
+++ b/src/pgm_receiver.hpp
@@ -30,6 +30,8 @@
#include "zmq_decoder.hpp"
#include "pgm_socket.hpp"
+#include <map>
+
namespace zmq
{
@@ -45,7 +47,6 @@ namespace zmq
~pgm_receiver_t ();
int init (bool udp_encapsulation_, const char *network_);
- void reconnect ();
// i_engine interface implementation.
void plug (struct i_inout *inout_);
@@ -57,15 +58,28 @@ namespace zmq
void out_event ();
private:
- // Read exactly iov_len_ count APDUs, function returns number
- // of bytes received. Note that if we did not join message stream
- // before and there is not message beginning in the APDUs being
- // received iov_len for such a APDUs will be 0.
- ssize_t receive_with_offset (void **data_);
-
- // Message decoder.
- zmq_decoder_t *decoder;
-
+
+ // Map to hold TSI, joined and decoder for each peer.
+ struct peer_info_t {
+ bool joined;
+ zmq_decoder_t *decoder;
+ };
+
+ struct tsi_comp {
+ bool operator () (const pgm_tsi_t &ltsi, const pgm_tsi_t &rtsi) const
+ {
+ if (ltsi.sport < rtsi.sport)
+ return true;
+
+ return (std::lexicographical_compare (ltsi.gsi.identifier,
+ ltsi.gsi.identifier + 6,
+ rtsi.gsi.identifier, rtsi.gsi.identifier + 6));
+ }
+ };
+
+ typedef std::map <pgm_tsi_t, peer_info_t, tsi_comp> peer_t;
+ peer_t peers;
+
// PGM socket.
pgm_socket_t pgm_socket;
@@ -75,9 +89,6 @@ namespace zmq
// Name of the session associated with the connecter.
std::string session_name;
- // If receiver joined the messages stream.
- bool joined;
-
// Parent session.
i_inout *inout;