summaryrefslogtreecommitdiff
path: root/src/socket_base.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/socket_base.hpp')
-rw-r--r--src/socket_base.hpp27
1 files changed, 17 insertions, 10 deletions
diff --git a/src/socket_base.hpp b/src/socket_base.hpp
index 79a8340..16553ea 100644
--- a/src/socket_base.hpp
+++ b/src/socket_base.hpp
@@ -34,6 +34,7 @@
#include "options.hpp"
#include "stdint.hpp"
#include "atomic_counter.hpp"
+#include "stdint.hpp"
namespace zmq
{
@@ -74,9 +75,15 @@ namespace zmq
// commands as it is unacceptable to wait for the completion of the
// action till user application yields control of the application
// thread to 0MQ. Locking is used instead.
+ // There are two distinct types of sessions: those identified by name
+ // and those identified by ordinal number. Thus two sets of session
+ // management functions.
bool register_session (const char *name_, class session_t *session_);
- bool unregister_session (const char *name_);
+ void unregister_session (const char *name_);
class session_t *find_session (const char *name_);
+ uint64_t register_session (class session_t *session_);
+ void unregister_session (uint64_t ordinal_);
+ class session_t *find_session (uint64_t ordinal_);
// i_endpoint interface implementation.
void attach_pipes (class reader_t *inpipe_, class writer_t *outpipe_);
@@ -144,15 +151,15 @@ namespace zmq
// Sequence number of the last command processed by this object.
uint64_t processed_seqnum;
- // List of existing sessions. This list is never referenced from within
- // the socket, instead it is used by I/O objects owned by the session.
- // As those objects can live in different threads, the access is
- // synchronised using 'sessions_sync' mutex.
- // Local sessions are those named by the local instance of 0MQ.
- // Remote sessions are the sessions who's identities are provided by
- // the remote party.
- typedef std::map <std::string, session_t*> sessions_t;
- sessions_t sessions;
+ // Lists of existing sessions. This lists are never referenced from
+ // within the socket, instead they are used by I/O objects owned by
+ // the socket. As those objects can live in different threads,
+ // the access is synchronised by mutex.
+ typedef std::map <std::string, session_t*> named_sessions_t;
+ named_sessions_t named_sessions;
+ typedef std::map <uint64_t, session_t*> unnamed_sessions_t;
+ unnamed_sessions_t unnamed_sessions;
+ uint64_t next_ordinal;
mutex_t sessions_sync;
socket_base_t (const socket_base_t&);