summaryrefslogtreecommitdiff
path: root/src/socket_base.hpp
diff options
context:
space:
mode:
authorMartin Sustrik <sustrik@fastmq.commkdir>2009-08-21 14:29:22 +0200
committerMartin Sustrik <sustrik@fastmq.commkdir>2009-08-21 14:29:22 +0200
commit6be4b0143793ab5ceebc5d9d6bbe5c2f1333a0d2 (patch)
treea785065e54317d1d360e2e4b3a4acf1d6e5669f1 /src/socket_base.hpp
parenta801b6d8b37557ccfb53030dca22f89a3f99b59c (diff)
session management implemented
Diffstat (limited to 'src/socket_base.hpp')
-rw-r--r--src/socket_base.hpp24
1 files changed, 15 insertions, 9 deletions
diff --git a/src/socket_base.hpp b/src/socket_base.hpp
index 8e99654..20ac4e2 100644
--- a/src/socket_base.hpp
+++ b/src/socket_base.hpp
@@ -40,23 +40,22 @@ namespace zmq
~socket_base_t ();
// Interface for communication with the API layer.
- virtual int setsockopt (int option_, void *optval_, size_t optvallen_);
+ virtual int setsockopt (int option_, const void *optval_,
+ size_t optvallen_);
virtual int bind (const char *addr_);
virtual int connect (const char *addr_);
- virtual int send (struct zmq_msg *msg_, int flags_);
+ virtual int send (struct zmq_msg_t *msg_, int flags_);
virtual int flush ();
- virtual int recv (struct zmq_msg *msg_, int flags_);
+ virtual int recv (struct zmq_msg_t *msg_, int flags_);
virtual int close ();
- // Functions that owned objects use to manipulate socket's list
- // of existing sessions.
- // Note that this functionality cannot be implemented via inter-thread
+ // The list of sessions cannot be accessed via inter-thread
// commands as it is unacceptable to wait for the completion of the
// action till user application yields control of the application
// thread to 0MQ.
- void register_session (const char *name_, class session_t *session_);
- void unregister_session (const char *name_);
- class session_t *get_session (const char *name_);
+ bool register_session (const char *name_, class session_t *session_);
+ bool unregister_session (const char *name_);
+ class session_t *find_session (const char *name_);
private:
@@ -80,10 +79,17 @@ namespace zmq
// Socket options.
options_t options;
+ // If true, socket is already shutting down. No new work should be
+ // started.
+ bool shutting_down;
+
// 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;
mutex_t sessions_sync;