Flow-IPC 1.0.1
Flow-IPC project: Full implementation reference.
Classes | Public Types | Public Member Functions | Static Public Attributes | Protected Types | Protected Member Functions | Private Types | Private Member Functions | Private Attributes | Related Functions | List of all members
ipc::session::Server_session_impl< S_MQ_TYPE_OR_NONE, S_TRANSMIT_NATIVE_HANDLES, Mdt_payload, S_SHM_TYPE_OR_NONE, S_SHM_MAX_HNDL_SZ, S_GRACEFUL_FINISH_REQUIRED_V > Class Template Reference

Internal, non-movable pImpl-lite implementation of Server_session_mv class template. More...

#include <server_session_impl.hpp>

Inheritance diagram for ipc::session::Server_session_impl< S_MQ_TYPE_OR_NONE, S_TRANSMIT_NATIVE_HANDLES, Mdt_payload, S_SHM_TYPE_OR_NONE, S_SHM_MAX_HNDL_SZ, S_GRACEFUL_FINISH_REQUIRED_V >:
[legend]
Collaboration diagram for ipc::session::Server_session_impl< S_MQ_TYPE_OR_NONE, S_TRANSMIT_NATIVE_HANDLES, Mdt_payload, S_SHM_TYPE_OR_NONE, S_SHM_MAX_HNDL_SZ, S_GRACEFUL_FINISH_REQUIRED_V >:
[legend]

Classes

struct  Open_channel_req
 An open-channel request out-message. More...
 

Public Types

using Base = Session_base< S_MQ_TYPE_OR_NONE, S_TRANSMIT_NATIVE_HANDLES, Mdt_payload >
 Short-hand for base type. More...
 
using Session_base_obj = Base
 Short-hand for Session_base super-class. More...
 
using Channel_obj = typename Base::Channel_obj
 See Server_session_mv counterpart. More...
 
using Channels = typename Base::Channels
 See Session_mv counterpart. More...
 
using Mdt_payload_obj = typename Base::Mdt_payload_obj
 See Server_session_mv counterpart. More...
 
using Mdt_reader_ptr = typename Base::Mdt_reader_ptr
 See Server_session_mv counterpart. More...
 
using Mdt_builder = typename Base::Mdt_builder
 See Server_session_mv counterpart. More...
 
using Mdt_builder_ptr = typename Base::Mdt_builder_ptr
 See Server_session_mv counterpart. More...
 
using Structured_msg_builder_config = typename Base::Structured_msg_builder_config
 See Session_mv counterpart. More...
 
using Structured_msg_reader_config = typename Base::Structured_msg_reader_config
 See Session_mv counterpart. More...
 
- Public Types inherited from ipc::session::Session_base< S_MQ_TYPE_OR_NONE, S_TRANSMIT_NATIVE_HANDLES, Mdt_payload >
using Persistent_mq_handle_from_cfg = std::conditional_t<!S_MQS_ENABLED, transport::Null_peer, std::conditional_t< S_MQ_TYPE_OR_NONE==schema::MqType::POSIX, transport::Posix_mq_handle, transport::Bipc_mq_handle > >
 Relevant only if S_MQS_ENABLED, this is the Persistent_mq_handle-concept impl type specified by the user via S_MQ_TYPE_OR_NONE. More...
 
using Channel_obj = std::conditional_t< S_MQS_ENABLED, std::conditional_t< S_TRANSMIT_NATIVE_HANDLES, transport::Mqs_socket_stream_channel< true, Persistent_mq_handle_from_cfg >, transport::Mqs_channel< true, Persistent_mq_handle_from_cfg > >, std::conditional_t< S_TRANSMIT_NATIVE_HANDLES, transport::Socket_stream_channel< true >, transport::Socket_stream_channel_of_blobs< true > > >
 See Session_mv (or Session concept). More...
 
using Channels = std::vector< Channel_obj >
 See Session_mv. Note: If changed from vector please update those doc headers too. More...
 
using Mdt_payload_obj = Mdt_payload
 See Session_mv (or Session concept). More...
 
using Mdt_reader_ptr = boost::shared_ptr< typename transport::struc::schema::Metadata< Mdt_payload_obj >::Reader >
 See Session_mv (or Session concept). More...
 
using Mdt_builder = typename transport::struc::schema::Metadata< Mdt_payload_obj >::Builder
 See Session_mv (or Session concept). More...
 
using Mdt_builder_ptr = boost::shared_ptr< Mdt_builder >
 See Session_mv (or Session concept). More...
 
using Structured_msg_builder_config = transport::struc::Heap_fixed_builder::Config
 See Session_mv (or Session concept). More...
 
using Structured_msg_reader_config = transport::struc::Heap_reader::Config
 See Session_mv (or Session concept). More...
 

Public Member Functions

 Server_session_impl (flow::log::Logger *logger_ptr, const Server_app &srv_app_ref, transport::sync_io::Native_socket_stream &&master_channel_sock_stm)
 For use by internal user Session_server: See Server_session_mv counterpart. More...
 
 ~Server_session_impl ()
 See Server_session_mv counterpart. More...
 
template<typename Session_server_impl_t , typename Task_err , typename Cli_app_lookup_func , typename Cli_namespace_func , typename Pre_rsp_setup_func , typename N_init_channels_by_srv_req_func , typename Mdt_load_func >
void async_accept_log_in (Session_server_impl_t *srv, Channels *init_channels_by_srv_req, Mdt_reader_ptr *mdt_from_cli_or_null, Channels *init_channels_by_cli_req, Cli_app_lookup_func &&cli_app_lookup_func, Cli_namespace_func &&cli_namespace_func, Pre_rsp_setup_func &&pre_rsp_setup_func, N_init_channels_by_srv_req_func &&n_init_channels_by_srv_req_func, Mdt_load_func &&mdt_load_func, Task_err &&on_done_func)
 For use by internal user Session_server: See Server_session_mv counterpart. More...
 
const Client_appclient_app () const
 See Server_session_mv counterpart. More...
 
template<typename Task_err , typename On_passive_open_channel_handler >
bool init_handlers (Task_err &&on_err_func_arg, On_passive_open_channel_handler &&on_passive_open_channel_func_arg)
 See Server_session_mv counterpart. More...
 
template<typename Task_err >
bool init_handlers (Task_err &&on_err_func_arg)
 See Server_session_mv counterpart. More...
 
Mdt_builder_ptr mdt_builder ()
 See Server_session_mv counterpart. More...
 
bool open_channel (Channel_obj *target_channel, const Mdt_builder_ptr &mdt, Error_code *err_code=0)
 See Server_session_mv counterpart. More...
 
bool open_channel (Channel_obj *target_channel, Error_code *err_code=0)
 See Server_session_mv counterpart. More...
 
const Session_tokensession_token () const
 See Server_session_mv counterpart. More...
 
const Basebase () const
 See Server_session_mv counterpart. More...
 
- Public Member Functions inherited from ipc::session::Session_base< S_MQ_TYPE_OR_NONE, S_TRANSMIT_NATIVE_HANDLES, Mdt_payload >
const Shared_namesrv_namespace () const
 See Server_session_impl, Client_session_impl. More...
 
const Shared_namecli_namespace () const
 See Server_session_impl, Client_session_impl. More...
 
const Client_appcli_app_ptr () const
 See Server_session_impl, Client_session_impl. More...
 
Shared_name cur_ns_store_mutex_absolute_name () const
 Computes the name of the interprocess named-mutex used to control reading/writing to the file storing (written by server, read by client) the value for srv_namespace(). More...
 
fs::path cur_ns_store_absolute_path () const
 Computes the absolute path to file storing (written by server, read by client) the value for srv_namespace(). More...
 
Shared_name session_master_socket_stream_acceptor_absolute_name () const
 Computes the absolute name at which the server shall set up a transport::Native_socket_stream_acceptor to which client shall transport::Native_socket_stream::sync_connect() in order to establish a PEER-state session. More...
 

Static Public Attributes

static constexpr schema::ShmType S_SHM_TYPE = S_SHM_TYPE_OR_NONE
 See Session_mv counterpart. More...
 
static constexpr bool S_SHM_ENABLED = S_SHM_TYPE != schema::ShmType::NONE
 See Session_mv counterpart. More...
 
static constexpr bool S_MQS_ENABLED = Base::S_MQS_ENABLED
 See Server_session_mv counterpart. More...
 
static constexpr bool S_SOCKET_STREAM_ENABLED = Base::S_SOCKET_STREAM_ENABLED
 See Server_session_mv counterpart. More...
 
static constexpr bool S_GRACEFUL_FINISH_REQUIRED = S_GRACEFUL_FINISH_REQUIRED_V
 Short-hand for template parameter knob S_GRACEFUL_FINISH_REQUIRED_V: see class template doc header. More...
 
- Static Public Attributes inherited from ipc::session::Session_base< S_MQ_TYPE_OR_NONE, S_TRANSMIT_NATIVE_HANDLES, Mdt_payload >
static constexpr bool S_MQS_ENABLED = S_MQ_TYPE_OR_NONE != schema::MqType::NONE
 See Session_mv. More...
 
static constexpr bool S_SOCKET_STREAM_ENABLED = (!S_MQS_ENABLED) || S_TRANSMIT_NATIVE_HANDLES
 See Session_mv. More...
 

Protected Types

using Master_structured_channel = typename Base::Master_structured_channel
 See Session_base. More...
 
- Protected Types inherited from ipc::session::Session_base< S_MQ_TYPE_OR_NONE, S_TRANSMIT_NATIVE_HANDLES, Mdt_payload >
using Master_structured_channel = transport::struc::Channel_via_heap< transport::Socket_stream_channel< true >, schema::detail::SessionMasterChannelMessageBody< Mdt_payload_obj > >
 The (internally used) session master channel is a transport::struc::Channel of this concrete type. More...
 
using Master_structured_channel_ptr = boost::shared_ptr< Master_structured_channel >
 Handle to Master_structured_channel. More...
 
using Master_structured_channel_observer = boost::weak_ptr< Master_structured_channel >
 Observer of Master_structured_channel_ptr. See its doc header. More...
 
using On_passive_open_channel_func = Function< void(Channel_obj &&new_channel, Mdt_reader_ptr &&new_channel_mdt)>
 Concrete function type for the on-passive-open handler (if any), used for storage. More...
 

Protected Member Functions

template<typename Task >
void sub_class_set_deinit_func (Task &&task)
 Utility for sub-classes: ensures that task() is invoked near the end of *this dtor's execution, from thread U, after thread W is joined, and any async_accept_log_in() on-done handler has fired with operation-aborted code. More...
 
flow::async::Single_thread_task_loop * async_worker ()
 Utility for sub-classes: provides ability to schedule or post tasks onto thread W. More...
 
Master_structured_channelmaster_channel ()
 Utility for sub-classes: provides ability to do work on the session master channel after our async_accept_log_in() succeeds, but before the sub-classed wrapper of its on-done handler succeeds. More...
 
const Master_structured_channelmaster_channel_const () const
 Analogous to Client_session_impl::master_channel_const(). More...
 
void dtor_async_worker_stop ()
 Analogous to Client_session_impl::dtor_async_worker_stop(). See that doc header. More...
 
- Protected Member Functions inherited from ipc::session::Session_base< S_MQ_TYPE_OR_NONE, S_TRANSMIT_NATIVE_HANDLES, Mdt_payload >
 Session_base (const Client_app &cli_app_ref, const Server_app &srv_app_ref, flow::async::Task_asio_err &&on_err_func, On_passive_open_channel_func &&on_passive_open_channel_func_or_empty_arg)
 Constructs: Client_session_impl form (the user is the one constructing the object, though in NULL state). More...
 
 Session_base (const Server_app &srv_app_ref)
 Constructs: Server_session_impl form (Session_server is the one constructing the object, though in NULL state, before log-in has completed, but after the socket-stream connection has been established). More...
 
void set_srv_namespace (Shared_name &&srv_namespace_new)
 Sets srv_namespace() (do not call if already set). More...
 
void set_cli_namespace (Shared_name &&cli_namespace_new)
 Sets cli_namespace() (do not call if already set). More...
 
void set_cli_app_ptr (const Client_app *cli_app_ptr_new)
 Sets cli_app_ptr() (do not call if already set). More...
 
void set_on_passive_open_channel_func (On_passive_open_channel_func &&on_passive_open_channel_func)
 Sets on_passive_open_channel_func_or_empty() (do not call if already set; do not call if user intends for passive-opens to be disabled on this side). More...
 
void set_on_err_func (flow::async::Task_asio_err &&on_err_func_arg)
 Sets on_err_func() (do not call if already set). More...
 
bool on_err_func_set () const
 Returns true if and only if set_on_err_func() has been called. More...
 
const On_passive_open_channel_funcon_passive_open_channel_func_or_empty () const
 The on-passive-open handler (may be empty even in final state, meaning user wants passive-opens disabled on this side). More...
 
void hose (const Error_code &err_code)
 Marks this session as hosed for (truthy) reason err_code; and synchronously invokes on-error handler; only invoke if not already hosed(). More...
 
bool hosed () const
 Returns true if and only if hose() has been called. More...
 

Private Types

using Persistent_mq_handle_from_cfg = typename Base::Persistent_mq_handle_from_cfg
 See Session_base. More...
 
using On_passive_open_channel_func = typename Base::On_passive_open_channel_func
 See Session_base. More...
 
using Master_structured_channel_ptr = typename Base::Master_structured_channel_ptr
 See Session_base. More...
 
using Open_channel_req_ptr = boost::shared_ptr< Open_channel_req >
 Short-hand for ref-counted pointer to Open_channel_req. More...
 

Private Member Functions

bool init_handlers_impl (flow::async::Task_asio_err &&on_err_func_arg, On_passive_open_channel_func &&on_passive_open_channel_func_or_empty_arg)
 Core of both init_handlers() overloads, to be invoked in thread W. More...
 
bool handlers_are_set () const
 In thread W, returns whether init_handlers_impl() has yet executed. More...
 
void on_master_channel_error (const Error_code &err_code)
 In thread W, handler for m_master_channel indicating incoming-direction channel-hosing error. More...
 
void on_master_channel_open_channel_req (typename Master_structured_channel::Msg_in_ptr &&open_channel_req)
 In thread W, handler for m_master_channel receiving a passive-open (a/k/a open-channel-to-server) request. More...
 
bool create_channel_and_resources (Shared_name *mq_name_c2s_or_none_ptr, Shared_name *mq_name_s2c_or_none_ptr, util::Native_handle *remote_hndl_or_null_ptr, Channel_obj *opened_channel_ptr, bool active_else_passive)
 In thread W acquires the needed shared sources (MQs and/or Native_handle pair as of this writing) and creates local Channel_obj to emit to the user thus completing the channel-open on this side. More...
 
bool make_channel_mqs (Persistent_mq_handle_from_cfg *mq_c2s, Persistent_mq_handle_from_cfg *mq_s2c, Shared_name *mq_name_c2s, Shared_name *mq_name_s2c, Error_code *err_code)
 Helper for create_channel_and_resources(), invoked and compiled if and only if S_MQS_ENABLED, that creates the underlying client->server and server->client MQs and local handles thereto, and outputs these things via out-args. More...
 

Private Attributes

transport::Protocol_negotiator m_protocol_negotiator
 Handles the protocol negotiation at the start of the pipe, as pertains to algorithms perpetuated by the vanilla ipc::session Session hierarchy. More...
 
transport::Protocol_negotiator m_protocol_negotiator_aux
 Analogous to m_protocol_negotiator but pertains to algorithms perpetuated by (if relevant) non-vanilla ipc::session Session hierarchy implemented on top of our vanilla ipc::session Session hierarchy. More...
 
flow::async::Task_asio_err m_log_in_on_done_func
 The on_done_func argument to async_accept_log_in(); .empty() except while the (at most one, ever) async_accept_log_in() is outstanding. More...
 
transport::sync_io::Native_socket_stream m_master_sock_stm
 The pre-connected (PEER-state) socket stream peer; is non-as-if-default-cted only up to async_accept_log_in(), at which point it is moved-to m_master_channel. More...
 
Error_code m_pre_init_err_code
 Unused/falsy except when in almost-PEER state (past successful async_accept_log_in(), before init_handlers() invoked by user), and m_master_channel reports incoming-direction error. More...
 
unsigned int m_last_passively_opened_channel_id
 Identical to Client_session_impl::m_last_passively_opened_channel_id. More...
 
unsigned int m_last_actively_opened_channel_id
 Identical to Client_session_impl::m_last_actively_opened_channel_id. More...
 
unsigned int m_last_channel_mq_id
 Unique component of MQ names generated by make_channel_mqs() (if relevant; else untouched). More...
 
flow::async::Single_thread_task_loop m_async_worker
 Worker thread (a/k/a thread W). More...
 
Master_structured_channel_ptr m_master_channel
 The session master channel. More...
 
Function< void()> m_deinit_func_or_empty
 See sub_class_set_deinit_func(). .empty() unless that was called at least once. More...
 
std::optional< typename Base::Graceful_finisherm_graceful_finisher
 Null until PEER state is reached, and NULL unless compile-time S_GRACEFUL_FINISH_REQUIRED is true, this is used to block at the start of dtor to synchronize with the opposing Session dtor for safety. More...
 

Related Functions

(Note that these are not member functions.)

template<schema::MqType S_MQ_TYPE_OR_NONE, bool S_TRANSMIT_NATIVE_HANDLES, typename Mdt_payload , schema::ShmType S_SHM_TYPE_OR_NONE, size_t S_SHM_MAX_HNDL_SZ, bool S_GRACEFUL_FINISH_REQUIRED_V>
std::ostream & operator<< (std::ostream &os, const Server_session_impl< S_MQ_TYPE_OR_NONE, S_TRANSMIT_NATIVE_HANDLES, Mdt_payload, S_SHM_TYPE_OR_NONE, S_SHM_MAX_HNDL_SZ, S_GRACEFUL_FINISH_REQUIRED_V > &val)
 Prints string representation of the given Server_session_impl to the given ostream. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from ipc::session::Session_base< S_MQ_TYPE_OR_NONE, S_TRANSMIT_NATIVE_HANDLES, Mdt_payload >
static Structured_msg_builder_config heap_fixed_builder_config (flow::log::Logger *logger_ptr)
 See Session_mv::heap_fixed_builder_config() (1-arg). More...
 
static Structured_msg_reader_config heap_reader_config (flow::log::Logger *logger_ptr)
 See Session_mv::heap_reader_config() (1-arg). More...
 
- Public Attributes inherited from ipc::session::Session_base< S_MQ_TYPE_OR_NONE, S_TRANSMIT_NATIVE_HANDLES, Mdt_payload >
const Server_appm_srv_app_ref
 Reference to Server_app (referring to local process in Server_session_impl, opposing process in Client_session_impl). More...
 
- Static Protected Attributes inherited from ipc::session::Session_base< S_MQ_TYPE_OR_NONE, S_TRANSMIT_NATIVE_HANDLES, Mdt_payload >
static constexpr util::Fine_duration S_OPEN_CHANNEL_TIMEOUT = boost::chrono::seconds(60)
 Internal timeout for open_channel(). More...
 
static constexpr size_t S_MQS_MAX_MSG_SZ = 8 * 1024
 The max sendable MQ message size as decided by Server_session_impl::make_channel_mqs() (and imposed on both sides, both directions), if S_MQS_ENABLED and Server_session_impl::S_SHM_ENABLED is false, when a channel is opened (regardless of which side did the active-open or requested pre-opening at session start). More...
 

Detailed Description

template<schema::MqType S_MQ_TYPE_OR_NONE, bool S_TRANSMIT_NATIVE_HANDLES, typename Mdt_payload, schema::ShmType S_SHM_TYPE_OR_NONE, size_t S_SHM_MAX_HNDL_SZ, bool S_GRACEFUL_FINISH_REQUIRED_V>
class ipc::session::Server_session_impl< S_MQ_TYPE_OR_NONE, S_TRANSMIT_NATIVE_HANDLES, Mdt_payload, S_SHM_TYPE_OR_NONE, S_SHM_MAX_HNDL_SZ, S_GRACEFUL_FINISH_REQUIRED_V >

Internal, non-movable pImpl-lite implementation of Server_session_mv class template.

In and of itself it would have been directly and publicly usable; however Server_session_mv adds move semantics.

See also
All discussion of the public (and protected, to be exposed publicly by Server_session_dtl) API is in Server_session_mv doc header; that class template forwards to this one. All discussion of pImpl-lite-related notions is also there. See that doc header first please. Then come back here.

Impl design

Generally, I (ygoldfel) recommend looking through and understanding Client_session_impl first. It is similar but somewhat more complex, and once it is understood, you'll be able to understand Server_session_impl easily. Plus its logic is complementary to a *this, as the two directly interoperate via a couple of IPC forms. The below discussion does assume one has read/understood Client_session_impl doc header.

Thread U represents all threads other than thread W: since the relevant methods are to be called by the user sans concurrency, those threads as a collection can be thought of as one thread.

Thread W is the async worker thread where most work is done; this helps us entirely avoid mutexes. async_accept_log_in() is called exactly once, internally by Session_server; and subsequently open_channel() is fairly infrequently called. So it's not necessary to avoid latency by doing work concurrently in threads U and W. So we keep it simple by posting most stuff onto thread W.

The state machine of Server_session_impl is simpler than Client_session_impl. The asymmetry is, firstly, due to the client-server setup: Session_server is the one, on the server end, that awaits the initial transport::Native_socket_stream connection. Once a PEER-state Native_socket_stream is ready, only then does Session_server create a Server_session_dtl (which is a public facade to Server_session_mv, which is a movable unique_ptr wrapper around this Server_session_impl). So *this, unlike a Client_session_impl, does not need to connect a socket. Next, Server_session_impl just needs to complete one async step, which is in practice immediately (and, by contract, only once) invoked: async_accept_log_in(). At this stage user does not have the Server_session_mv yet, so we're still in internal-code land. (By contrast Client_session is created directly by the user and is immediately publicly available as a stand-alone object.) async_accept_log_in() immediately upgrades the Native_socket_stream to a transport::Channel and then immediately upgrades that to a transport::struc::Channel, saving it to m_master_channel (all synchronously). Lastly is the actual async work: awaiting the log-in request from Client_session. Once that is received, we respond via m_master_channel, either with log-in success or failure. Assuming success, we invoke the (internal) async_accept_log_in() handler; on failure same thing but with a failure Error_code.

Sidebar: Init-channels

Update (init-channels feature has been added): The preceding paragraph holds fully if and only if:

However, if the sum of these 2 numbers (as determined upon successful receipt on LogInReq, and assuming everything else was also successful, up-to-and-including sending successful LogInRsp) is N=1+, then before async_accept_log_in() can reach almost-PEER state (and fire completion handler), there is 1 more async-step:

Why this last async step? Couldn't we just do the send()s and go to almost-PEER state immediately? Almost: but if we did that, then if the user immediately issued init_handlers() and an open_channel(), then the opposing Client_session_impl might not, technically, be quick enough to have moved to its own PEER state; then its OpenChannelToClientReq handler from the pre-PEER state (CONNECTING state) might be triggered; this would cause... nothing good. However the ACK from Client_session_impl is sent only just before entering PEER state, at which point it is safe for us to issue open_channel()s.

Back to general impl discussion

Our async_accept_log_in() is analogous/complementary to Client_session_impl::async_connect(), but the diff is that the user only gets access to a *this upon success of this async op; and never gets access upon failure at all. So that's another source of asymmetry versus Client_session_impl. Thus:

Therefore there's no need to track an m_state the way Client_session_impl does. If m_log_in_on_done_func is non-empty, then async_accept_log_in() is outstanding (analogous to Client_session_impl CONNECTING state). Otherwise see the "almost-PEER" section just below.

Almost-PEER state impl

There is a minor wrinkle in Server_session_mv (and thus Server_session_impl). Once the user obtains the Server_session_mv, it is in the so-called almost-PEER state. That is because it needs 1-2 more pieces of info to be set before it is formally in PEER state as specified by Session concept. Namely its on-error handler must be set (mandatory), as must its on-passive-open handler (optional; in that leaving it unspecified is allowed and means passive-opens are disabled on this side). To do so the user shall call init_handlers(). Until this is done, open_channel() and other public PEER-state APIs shall no-op and return sentinel/false.

There is a subtlety in how this are-handlers-set check is performed. The crux of it is that m_master_channel can report an error at any time starting with async_accept_log_in() (where it is first created), and what to do is quite different in each case:

Because the m_master_channel error handler is relevant across all of the above, and it is executed in thread W for reasons explained above (avoiding mutexes, etc.), to avoid concurrency difficulties the are-handlers-set check, and the assignment of the handlers, is also done in thread W. Hence, like most code in Server_session_impl, init_handlers() posts all its work onto thread W. All public APIs, even simple ones like session_token(), do the same, and that thread-W work always begins by ensuring handlers_are_set().

Once PEER state is achieved, to the user *this is (just like Client_session_impl) an impl of Session concept. Internally it's somewhat different.

PEER state impl

Here our algorithm is complementary to the PEER state algorithm in Client_session_impl. Namely we expect passive-opens via an appropriate transport::struc::Channel::expect_msgs(); and we allow active-opens via open_channel(). The details of how these work is best understood just by reading that code inline. All in all, publicly it's just like Client_session_impl; but internally it is its complement and in fact has different (complementary) responsibilities. Most notably, regarding active-opens and passive-opens:

Client_session_impl active-opens and passive-opens act in a complementary fashion, never acquiring these resources but knowing what to expect.

Otherwise open_channel() is set up similarly to Client_session_impl::open_channel(), namely the non-blocking/synchronous facade with async-with-timeout internals. See Client_session_impl doc header for brief discussion.

Template Parameters
S_MQ_TYPE_OR_NONESee Server_session counterpart.
S_TRANSMIT_NATIVE_HANDLESSee Server_session counterpart.
Mdt_payloadSee Server_session counterpart.
S_SHM_TYPE_OR_NONESee common.capnp ShmType capnp-enum definition.
S_SHM_MAX_HNDL_SZIgnored if S_SHM_TYPE_OR_NONE indicates we are not SHM-enabled, this otherwise indicates the max size of a SHM handle's blob serialization. If ignored it must be set to 0 (convention).
S_GRACEFUL_FINISH_REQUIRED_Vtrue if and only if Session_base::Graceful_finisher must be used. See its doc header for explanation when that would be the case.

Definition at line 185 of file server_session_impl.hpp.

Member Typedef Documentation

◆ Base

template<schema::MqType S_MQ_TYPE_OR_NONE, bool S_TRANSMIT_NATIVE_HANDLES, typename Mdt_payload , schema::ShmType S_SHM_TYPE_OR_NONE, size_t S_SHM_MAX_HNDL_SZ, bool S_GRACEFUL_FINISH_REQUIRED_V>
using ipc::session::Server_session_impl< S_MQ_TYPE_OR_NONE, S_TRANSMIT_NATIVE_HANDLES, Mdt_payload, S_SHM_TYPE_OR_NONE, S_SHM_MAX_HNDL_SZ, S_GRACEFUL_FINISH_REQUIRED_V >::Base = Session_base<S_MQ_TYPE_OR_NONE, S_TRANSMIT_NATIVE_HANDLES, Mdt_payload>

Short-hand for base type.

Definition at line 193 of file server_session_impl.hpp.

◆ Channel_obj

template<schema::MqType S_MQ_TYPE_OR_NONE, bool S_TRANSMIT_NATIVE_HANDLES, typename Mdt_payload , schema::ShmType S_SHM_TYPE_OR_NONE, size_t S_SHM_MAX_HNDL_SZ, bool S_GRACEFUL_FINISH_REQUIRED_V>
using ipc::session::Server_session_impl< S_MQ_TYPE_OR_NONE, S_TRANSMIT_NATIVE_HANDLES, Mdt_payload, S_SHM_TYPE_OR_NONE, S_SHM_MAX_HNDL_SZ, S_GRACEFUL_FINISH_REQUIRED_V >::Channel_obj = typename Base::Channel_obj

See Server_session_mv counterpart.

Definition at line 199 of file server_session_impl.hpp.

◆ Channels

template<schema::MqType S_MQ_TYPE_OR_NONE, bool S_TRANSMIT_NATIVE_HANDLES, typename Mdt_payload , schema::ShmType S_SHM_TYPE_OR_NONE, size_t S_SHM_MAX_HNDL_SZ, bool S_GRACEFUL_FINISH_REQUIRED_V>
using ipc::session::Server_session_impl< S_MQ_TYPE_OR_NONE, S_TRANSMIT_NATIVE_HANDLES, Mdt_payload, S_SHM_TYPE_OR_NONE, S_SHM_MAX_HNDL_SZ, S_GRACEFUL_FINISH_REQUIRED_V >::Channels = typename Base::Channels

See Session_mv counterpart.

Definition at line 202 of file server_session_impl.hpp.

◆ Master_structured_channel

template<schema::MqType S_MQ_TYPE_OR_NONE, bool S_TRANSMIT_NATIVE_HANDLES, typename Mdt_payload , schema::ShmType S_SHM_TYPE_OR_NONE, size_t S_SHM_MAX_HNDL_SZ, bool S_GRACEFUL_FINISH_REQUIRED_V>
using ipc::session::Server_session_impl< S_MQ_TYPE_OR_NONE, S_TRANSMIT_NATIVE_HANDLES, Mdt_payload, S_SHM_TYPE_OR_NONE, S_SHM_MAX_HNDL_SZ, S_GRACEFUL_FINISH_REQUIRED_V >::Master_structured_channel = typename Base::Master_structured_channel
protected

See Session_base.

Definition at line 376 of file server_session_impl.hpp.

◆ Master_structured_channel_ptr

template<schema::MqType S_MQ_TYPE_OR_NONE, bool S_TRANSMIT_NATIVE_HANDLES, typename Mdt_payload , schema::ShmType S_SHM_TYPE_OR_NONE, size_t S_SHM_MAX_HNDL_SZ, bool S_GRACEFUL_FINISH_REQUIRED_V>
using ipc::session::Server_session_impl< S_MQ_TYPE_OR_NONE, S_TRANSMIT_NATIVE_HANDLES, Mdt_payload, S_SHM_TYPE_OR_NONE, S_SHM_MAX_HNDL_SZ, S_GRACEFUL_FINISH_REQUIRED_V >::Master_structured_channel_ptr = typename Base::Master_structured_channel_ptr
private

See Session_base.

Definition at line 441 of file server_session_impl.hpp.

◆ Mdt_builder

template<schema::MqType S_MQ_TYPE_OR_NONE, bool S_TRANSMIT_NATIVE_HANDLES, typename Mdt_payload , schema::ShmType S_SHM_TYPE_OR_NONE, size_t S_SHM_MAX_HNDL_SZ, bool S_GRACEFUL_FINISH_REQUIRED_V>
using ipc::session::Server_session_impl< S_MQ_TYPE_OR_NONE, S_TRANSMIT_NATIVE_HANDLES, Mdt_payload, S_SHM_TYPE_OR_NONE, S_SHM_MAX_HNDL_SZ, S_GRACEFUL_FINISH_REQUIRED_V >::Mdt_builder = typename Base::Mdt_builder

See Server_session_mv counterpart.

Definition at line 211 of file server_session_impl.hpp.

◆ Mdt_builder_ptr

template<schema::MqType S_MQ_TYPE_OR_NONE, bool S_TRANSMIT_NATIVE_HANDLES, typename Mdt_payload , schema::ShmType S_SHM_TYPE_OR_NONE, size_t S_SHM_MAX_HNDL_SZ, bool S_GRACEFUL_FINISH_REQUIRED_V>
using ipc::session::Server_session_impl< S_MQ_TYPE_OR_NONE, S_TRANSMIT_NATIVE_HANDLES, Mdt_payload, S_SHM_TYPE_OR_NONE, S_SHM_MAX_HNDL_SZ, S_GRACEFUL_FINISH_REQUIRED_V >::Mdt_builder_ptr = typename Base::Mdt_builder_ptr

See Server_session_mv counterpart.

Definition at line 214 of file server_session_impl.hpp.

◆ Mdt_payload_obj

template<schema::MqType S_MQ_TYPE_OR_NONE, bool S_TRANSMIT_NATIVE_HANDLES, typename Mdt_payload , schema::ShmType S_SHM_TYPE_OR_NONE, size_t S_SHM_MAX_HNDL_SZ, bool S_GRACEFUL_FINISH_REQUIRED_V>
using ipc::session::Server_session_impl< S_MQ_TYPE_OR_NONE, S_TRANSMIT_NATIVE_HANDLES, Mdt_payload, S_SHM_TYPE_OR_NONE, S_SHM_MAX_HNDL_SZ, S_GRACEFUL_FINISH_REQUIRED_V >::Mdt_payload_obj = typename Base::Mdt_payload_obj

See Server_session_mv counterpart.

Definition at line 205 of file server_session_impl.hpp.

◆ Mdt_reader_ptr

template<schema::MqType S_MQ_TYPE_OR_NONE, bool S_TRANSMIT_NATIVE_HANDLES, typename Mdt_payload , schema::ShmType S_SHM_TYPE_OR_NONE, size_t S_SHM_MAX_HNDL_SZ, bool S_GRACEFUL_FINISH_REQUIRED_V>
using ipc::session::Server_session_impl< S_MQ_TYPE_OR_NONE, S_TRANSMIT_NATIVE_HANDLES, Mdt_payload, S_SHM_TYPE_OR_NONE, S_SHM_MAX_HNDL_SZ, S_GRACEFUL_FINISH_REQUIRED_V >::Mdt_reader_ptr = typename Base::Mdt_reader_ptr

See Server_session_mv counterpart.

Definition at line 208 of file server_session_impl.hpp.

◆ On_passive_open_channel_func

template<schema::MqType S_MQ_TYPE_OR_NONE, bool S_TRANSMIT_NATIVE_HANDLES, typename Mdt_payload , schema::ShmType S_SHM_TYPE_OR_NONE, size_t S_SHM_MAX_HNDL_SZ, bool S_GRACEFUL_FINISH_REQUIRED_V>
using ipc::session::Server_session_impl< S_MQ_TYPE_OR_NONE, S_TRANSMIT_NATIVE_HANDLES, Mdt_payload, S_SHM_TYPE_OR_NONE, S_SHM_MAX_HNDL_SZ, S_GRACEFUL_FINISH_REQUIRED_V >::On_passive_open_channel_func = typename Base::On_passive_open_channel_func
private

See Session_base.

Definition at line 438 of file server_session_impl.hpp.

◆ Open_channel_req_ptr

template<schema::MqType S_MQ_TYPE_OR_NONE, bool S_TRANSMIT_NATIVE_HANDLES, typename Mdt_payload , schema::ShmType S_SHM_TYPE_OR_NONE, size_t S_SHM_MAX_HNDL_SZ, bool S_GRACEFUL_FINISH_REQUIRED_V>
using ipc::session::Server_session_impl< S_MQ_TYPE_OR_NONE, S_TRANSMIT_NATIVE_HANDLES, Mdt_payload, S_SHM_TYPE_OR_NONE, S_SHM_MAX_HNDL_SZ, S_GRACEFUL_FINISH_REQUIRED_V >::Open_channel_req_ptr = boost::shared_ptr<Open_channel_req>
private

Short-hand for ref-counted pointer to Open_channel_req.

See also
Client_session_impl::Open_channel_req doc header for info on the true nature of such shared_ptr as returned by us.

Definition at line 472 of file server_session_impl.hpp.

◆ Persistent_mq_handle_from_cfg

template<schema::MqType S_MQ_TYPE_OR_NONE, bool S_TRANSMIT_NATIVE_HANDLES, typename Mdt_payload , schema::ShmType S_SHM_TYPE_OR_NONE, size_t S_SHM_MAX_HNDL_SZ, bool S_GRACEFUL_FINISH_REQUIRED_V>
using ipc::session::Server_session_impl< S_MQ_TYPE_OR_NONE, S_TRANSMIT_NATIVE_HANDLES, Mdt_payload, S_SHM_TYPE_OR_NONE, S_SHM_MAX_HNDL_SZ, S_GRACEFUL_FINISH_REQUIRED_V >::Persistent_mq_handle_from_cfg = typename Base::Persistent_mq_handle_from_cfg
private

See Session_base.

Definition at line 435 of file server_session_impl.hpp.

◆ Session_base_obj

template<schema::MqType S_MQ_TYPE_OR_NONE, bool S_TRANSMIT_NATIVE_HANDLES, typename Mdt_payload , schema::ShmType S_SHM_TYPE_OR_NONE, size_t S_SHM_MAX_HNDL_SZ, bool S_GRACEFUL_FINISH_REQUIRED_V>
using ipc::session::Server_session_impl< S_MQ_TYPE_OR_NONE, S_TRANSMIT_NATIVE_HANDLES, Mdt_payload, S_SHM_TYPE_OR_NONE, S_SHM_MAX_HNDL_SZ, S_GRACEFUL_FINISH_REQUIRED_V >::Session_base_obj = Base

Short-hand for Session_base super-class.

Definition at line 196 of file server_session_impl.hpp.

◆ Structured_msg_builder_config

template<schema::MqType S_MQ_TYPE_OR_NONE, bool S_TRANSMIT_NATIVE_HANDLES, typename Mdt_payload , schema::ShmType S_SHM_TYPE_OR_NONE, size_t S_SHM_MAX_HNDL_SZ, bool S_GRACEFUL_FINISH_REQUIRED_V>
using ipc::session::Server_session_impl< S_MQ_TYPE_OR_NONE, S_TRANSMIT_NATIVE_HANDLES, Mdt_payload, S_SHM_TYPE_OR_NONE, S_SHM_MAX_HNDL_SZ, S_GRACEFUL_FINISH_REQUIRED_V >::Structured_msg_builder_config = typename Base::Structured_msg_builder_config

See Session_mv counterpart.

Definition at line 217 of file server_session_impl.hpp.

◆ Structured_msg_reader_config

template<schema::MqType S_MQ_TYPE_OR_NONE, bool S_TRANSMIT_NATIVE_HANDLES, typename Mdt_payload , schema::ShmType S_SHM_TYPE_OR_NONE, size_t S_SHM_MAX_HNDL_SZ, bool S_GRACEFUL_FINISH_REQUIRED_V>
using ipc::session::Server_session_impl< S_MQ_TYPE_OR_NONE, S_TRANSMIT_NATIVE_HANDLES, Mdt_payload, S_SHM_TYPE_OR_NONE, S_SHM_MAX_HNDL_SZ, S_GRACEFUL_FINISH_REQUIRED_V >::Structured_msg_reader_config = typename Base::Structured_msg_reader_config

See Session_mv counterpart.

Definition at line 220 of file server_session_impl.hpp.

Constructor & Destructor Documentation

◆ Server_session_impl()

template<schema::MqType S_MQ_TYPE_OR_NONE, bool S_TRANSMIT_NATIVE_HANDLES, typename Mdt_payload , schema::ShmType S_SHM_TYPE_OR_NONE, size_t S_SHM_MAX_HNDL_SZ, bool S_GRACEFUL_FINISH_REQUIRED_V>
ipc::session::Server_session_impl< S_MQ_TYPE_OR_NONE, S_TRANSMIT_NATIVE_HANDLES, Mdt_payload, S_SHM_TYPE_OR_NONE, S_SHM_MAX_HNDL_SZ, S_GRACEFUL_FINISH_REQUIRED_V >::Server_session_impl ( flow::log::Logger *  logger_ptr,
const Server_app srv_app_ref,
transport::sync_io::Native_socket_stream &&  master_channel_sock_stm 
)
explicit

◆ ~Server_session_impl()

template<schema::MqType S_MQ_TYPE_OR_NONE, bool S_TRANSMIT_NATIVE_HANDLES, typename Mdt_payload , schema::ShmType S_SHM_TYPE_OR_NONE, size_t S_SHM_MAX_HNDL_SZ, bool S_GRACEFUL_FINISH_REQUIRED_V>
ipc::session::Server_session_impl< S_MQ_TYPE_OR_NONE, S_TRANSMIT_NATIVE_HANDLES, Mdt_payload, S_SHM_TYPE_OR_NONE, S_SHM_MAX_HNDL_SZ, S_GRACEFUL_FINISH_REQUIRED_V >::~Server_session_impl

Member Function Documentation

◆ async_accept_log_in()

template<schema::MqType S_MQ_TYPE_OR_NONE, bool S_TRANSMIT_NATIVE_HANDLES, typename Mdt_payload , schema::ShmType S_SHM_TYPE_OR_NONE, size_t S_SHM_MAX_HNDL_SZ, bool S_GRACEFUL_FINISH_REQUIRED_V>
template<typename Session_server_impl_t , typename Task_err , typename Cli_app_lookup_func , typename Cli_namespace_func , typename Pre_rsp_setup_func , typename N_init_channels_by_srv_req_func , typename Mdt_load_func >
void ipc::session::Server_session_impl< S_MQ_TYPE_OR_NONE, S_TRANSMIT_NATIVE_HANDLES, Mdt_payload, S_SHM_TYPE_OR_NONE, S_SHM_MAX_HNDL_SZ, S_GRACEFUL_FINISH_REQUIRED_V >::async_accept_log_in ( Session_server_impl_t *  srv,
Channels init_channels_by_srv_req,
Mdt_reader_ptr mdt_from_cli_or_null,
Channels init_channels_by_cli_req,
Cli_app_lookup_func &&  cli_app_lookup_func,
Cli_namespace_func &&  cli_namespace_func,
Pre_rsp_setup_func &&  pre_rsp_setup_func,
N_init_channels_by_srv_req_func &&  n_init_channels_by_srv_req_func,
Mdt_load_func &&  mdt_load_func,
Task_err &&  on_done_func 
)

For use by internal user Session_server: See Server_session_mv counterpart.

Parameters
srvSee Server_session_mv counterpart.
init_channels_by_srv_reqSee Server_session_mv counterpart.
mdt_from_cli_or_nullSee Server_session_mv counterpart.
init_channels_by_cli_reqSee Server_session_mv counterpart.
cli_app_lookup_funcSee Server_session_mv counterpart.
cli_namespace_funcSee Server_session_mv counterpart.
pre_rsp_setup_funcSee Server_session_mv counterpart.
n_init_channels_by_srv_req_funcSee Server_session_mv counterpart.
mdt_load_funcSee Server_session_mv counterpart.
on_done_funcSee Server_session_mv counterpart.

Definition at line 1582 of file server_session_impl.hpp.

References ipc::transport::Socket_stream_channel< SIO >::remote_peer_process_credentials(), ipc::session::error::S_INVALID_ARGUMENT, ipc::transport::struc::Channel_base::S_SERIALIZE_VIA_HEAP, ipc::session::error::S_SERVER_MASTER_LOG_IN_REQUEST_CLIENT_APP_DISALLOWED_OR_UNKNOWN, ipc::session::error::S_SERVER_MASTER_LOG_IN_REQUEST_CLIENT_APP_INCONSISTENT_CREDS, ipc::session::error::S_SERVER_MASTER_LOG_IN_REQUEST_CONFIG_MISMATCH, ipc::session::error::S_SESSION_OPEN_CHANNEL_SERVER_CANNOT_PROCEED_RESOURCE_UNAVAILABLE, and ipc::util::Shared_name::str().

Here is the call graph for this function:

◆ async_worker()

template<schema::MqType S_MQ_TYPE_OR_NONE, bool S_TRANSMIT_NATIVE_HANDLES, typename Mdt_payload , schema::ShmType S_SHM_TYPE_OR_NONE, size_t S_SHM_MAX_HNDL_SZ, bool S_GRACEFUL_FINISH_REQUIRED_V>
flow::async::Single_thread_task_loop * ipc::session::Server_session_impl< S_MQ_TYPE_OR_NONE, S_TRANSMIT_NATIVE_HANDLES, Mdt_payload, S_SHM_TYPE_OR_NONE, S_SHM_MAX_HNDL_SZ, S_GRACEFUL_FINISH_REQUIRED_V >::async_worker
protected

Utility for sub-classes: provides ability to schedule or post tasks onto thread W.

Returns
See above.

Definition at line 2189 of file server_session_impl.hpp.

◆ base()

template<schema::MqType S_MQ_TYPE_OR_NONE, bool S_TRANSMIT_NATIVE_HANDLES, typename Mdt_payload , schema::ShmType S_SHM_TYPE_OR_NONE, size_t S_SHM_MAX_HNDL_SZ, bool S_GRACEFUL_FINISH_REQUIRED_V>
const Server_session_impl< S_MQ_TYPE_OR_NONE, S_TRANSMIT_NATIVE_HANDLES, Mdt_payload, S_SHM_TYPE_OR_NONE, S_SHM_MAX_HNDL_SZ, S_GRACEFUL_FINISH_REQUIRED_V >::Base & ipc::session::Server_session_impl< S_MQ_TYPE_OR_NONE, S_TRANSMIT_NATIVE_HANDLES, Mdt_payload, S_SHM_TYPE_OR_NONE, S_SHM_MAX_HNDL_SZ, S_GRACEFUL_FINISH_REQUIRED_V >::base

See Server_session_mv counterpart.

Returns
See Server_session_mv counterpart.

Definition at line 2176 of file server_session_impl.hpp.

◆ client_app()

template<schema::MqType S_MQ_TYPE_OR_NONE, bool S_TRANSMIT_NATIVE_HANDLES, typename Mdt_payload , schema::ShmType S_SHM_TYPE_OR_NONE, size_t S_SHM_MAX_HNDL_SZ, bool S_GRACEFUL_FINISH_REQUIRED_V>
const Client_app * ipc::session::Server_session_impl< S_MQ_TYPE_OR_NONE, S_TRANSMIT_NATIVE_HANDLES, Mdt_payload, S_SHM_TYPE_OR_NONE, S_SHM_MAX_HNDL_SZ, S_GRACEFUL_FINISH_REQUIRED_V >::client_app

See Server_session_mv counterpart.

Returns
See Server_session_mv counterpart.

Definition at line 829 of file server_session_impl.hpp.

◆ create_channel_and_resources()

template<schema::MqType S_MQ_TYPE_OR_NONE, bool S_TRANSMIT_NATIVE_HANDLES, typename Mdt_payload , schema::ShmType S_SHM_TYPE_OR_NONE, size_t S_SHM_MAX_HNDL_SZ, bool S_GRACEFUL_FINISH_REQUIRED_V>
bool ipc::session::Server_session_impl< S_MQ_TYPE_OR_NONE, S_TRANSMIT_NATIVE_HANDLES, Mdt_payload, S_SHM_TYPE_OR_NONE, S_SHM_MAX_HNDL_SZ, S_GRACEFUL_FINISH_REQUIRED_V >::create_channel_and_resources ( Shared_name mq_name_c2s_or_none_ptr,
Shared_name mq_name_s2c_or_none_ptr,
util::Native_handle remote_hndl_or_null_ptr,
Channel_obj opened_channel_ptr,
bool  active_else_passive 
)
private

In thread W acquires the needed shared sources (MQs and/or Native_handle pair as of this writing) and creates local Channel_obj to emit to the user thus completing the channel-open on this side.

If active-open on our part, we do this immediately in mdt_builder() – before open_channel() even – but before the Channel_obj can be emitted to the user (1) open_channel() must actually be called (obv) and (2) client must respond OK to our open-channel-to-client request out-message. If passive-open, we do this upon receiving client's open-channel-to-server request, before replying with our OK. Either way we are the ones acquiring the resources, then we send names/refs to those resources to client.

Returns false if and only if could not acquire resources.

Parameters
mq_name_c2s_or_none_ptrIf S_MQS_ENABLED this out-arg is the (non-empty) name of the client->server unidirectional MQ for the channel. Else ignored. Must be empty at entry or behavior undefined (assertion may trip).
mq_name_s2c_or_none_ptrLike the preceding but opposite-direction (server->client).
remote_hndl_or_null_ptrIf S_SOCKET_STREAM_ENABLED this out-arg is the pre-connected Native_handle to send to the other side; we keep the other end and shove it into the Channel_obj out-arg. Else ignored. Must be .null() or behavior undefined (assertion may trip).
opened_channel_ptrTarget Channel_obj we shall try to move-to PEER state. It'll be left unmodified if we return false.
active_else_passivetrue if this is from open_channel(); false if from on_master_channel_open_channel_req().
Returns
true on success; false if a resource could not be acquired.

Definition at line 1352 of file server_session_impl.hpp.

◆ dtor_async_worker_stop()

template<schema::MqType S_MQ_TYPE_OR_NONE, bool S_TRANSMIT_NATIVE_HANDLES, typename Mdt_payload , schema::ShmType S_SHM_TYPE_OR_NONE, size_t S_SHM_MAX_HNDL_SZ, bool S_GRACEFUL_FINISH_REQUIRED_V>
void ipc::session::Server_session_impl< S_MQ_TYPE_OR_NONE, S_TRANSMIT_NATIVE_HANDLES, Mdt_payload, S_SHM_TYPE_OR_NONE, S_SHM_MAX_HNDL_SZ, S_GRACEFUL_FINISH_REQUIRED_V >::dtor_async_worker_stop
protected

Analogous to Client_session_impl::dtor_async_worker_stop(). See that doc header.

Definition at line 708 of file server_session_impl.hpp.

References ipc::session::Session_base< S_MQ_TYPE_OR_NONE, S_TRANSMIT_NATIVE_HANDLES, Mdt_payload >::Graceful_finisher::on_dtor_start().

Here is the call graph for this function:

◆ handlers_are_set()

template<schema::MqType S_MQ_TYPE_OR_NONE, bool S_TRANSMIT_NATIVE_HANDLES, typename Mdt_payload , schema::ShmType S_SHM_TYPE_OR_NONE, size_t S_SHM_MAX_HNDL_SZ, bool S_GRACEFUL_FINISH_REQUIRED_V>
bool ipc::session::Server_session_impl< S_MQ_TYPE_OR_NONE, S_TRANSMIT_NATIVE_HANDLES, Mdt_payload, S_SHM_TYPE_OR_NONE, S_SHM_MAX_HNDL_SZ, S_GRACEFUL_FINISH_REQUIRED_V >::handlers_are_set
private

In thread W, returns whether init_handlers_impl() has yet executed.

This shall be checked in the thread-W body of ~all APIs in this class.

Returns
See above.

Definition at line 945 of file server_session_impl.hpp.

◆ init_handlers() [1/2]

template<schema::MqType S_MQ_TYPE_OR_NONE, bool S_TRANSMIT_NATIVE_HANDLES, typename Mdt_payload , schema::ShmType S_SHM_TYPE_OR_NONE, size_t S_SHM_MAX_HNDL_SZ, bool S_GRACEFUL_FINISH_REQUIRED_V>
template<typename Task_err >
bool ipc::session::Server_session_impl< S_MQ_TYPE_OR_NONE, S_TRANSMIT_NATIVE_HANDLES, Mdt_payload, S_SHM_TYPE_OR_NONE, S_SHM_MAX_HNDL_SZ, S_GRACEFUL_FINISH_REQUIRED_V >::init_handlers ( Task_err &&  on_err_func_arg)

See Server_session_mv counterpart.

Parameters
on_err_func_argSee Server_session_mv counterpart.
Returns
See Server_session_mv counterpart.

Definition at line 857 of file server_session_impl.hpp.

◆ init_handlers() [2/2]

template<schema::MqType S_MQ_TYPE_OR_NONE, bool S_TRANSMIT_NATIVE_HANDLES, typename Mdt_payload , schema::ShmType S_SHM_TYPE_OR_NONE, size_t S_SHM_MAX_HNDL_SZ, bool S_GRACEFUL_FINISH_REQUIRED_V>
template<typename Task_err , typename On_passive_open_channel_handler >
bool ipc::session::Server_session_impl< S_MQ_TYPE_OR_NONE, S_TRANSMIT_NATIVE_HANDLES, Mdt_payload, S_SHM_TYPE_OR_NONE, S_SHM_MAX_HNDL_SZ, S_GRACEFUL_FINISH_REQUIRED_V >::init_handlers ( Task_err &&  on_err_func_arg,
On_passive_open_channel_handler &&  on_passive_open_channel_func_arg 
)

See Server_session_mv counterpart.

Parameters
on_err_func_argSee Server_session_mv counterpart.
on_passive_open_channel_func_argSee Server_session_mv counterpart.
Returns
See Server_session_mv counterpart.

Definition at line 837 of file server_session_impl.hpp.

◆ init_handlers_impl()

template<schema::MqType S_MQ_TYPE_OR_NONE, bool S_TRANSMIT_NATIVE_HANDLES, typename Mdt_payload , schema::ShmType S_SHM_TYPE_OR_NONE, size_t S_SHM_MAX_HNDL_SZ, bool S_GRACEFUL_FINISH_REQUIRED_V>
bool ipc::session::Server_session_impl< S_MQ_TYPE_OR_NONE, S_TRANSMIT_NATIVE_HANDLES, Mdt_payload, S_SHM_TYPE_OR_NONE, S_SHM_MAX_HNDL_SZ, S_GRACEFUL_FINISH_REQUIRED_V >::init_handlers_impl ( flow::async::Task_asio_err &&  on_err_func_arg,
On_passive_open_channel_func &&  on_passive_open_channel_func_or_empty_arg 
)
private

Core of both init_handlers() overloads, to be invoked in thread W.

Parameters
on_err_func_argSee init_handlers(). Concretely-typed version of that arg.
on_passive_open_channel_func_or_empty_argSee init_handlers(). Concretely-typed version of that arg; or .empty() one if the passive-opens-disabled overload was called.
Returns
See init_handlers().

Definition at line 875 of file server_session_impl.hpp.

◆ make_channel_mqs()

template<schema::MqType S_MQ_TYPE_OR_NONE, bool S_TRANSMIT_NATIVE_HANDLES, typename Mdt_payload , schema::ShmType S_SHM_TYPE_OR_NONE, size_t S_SHM_MAX_HNDL_SZ, bool S_GRACEFUL_FINISH_REQUIRED_V>
bool ipc::session::Server_session_impl< S_MQ_TYPE_OR_NONE, S_TRANSMIT_NATIVE_HANDLES, Mdt_payload, S_SHM_TYPE_OR_NONE, S_SHM_MAX_HNDL_SZ, S_GRACEFUL_FINISH_REQUIRED_V >::make_channel_mqs ( Persistent_mq_handle_from_cfg mq_c2s,
Persistent_mq_handle_from_cfg mq_s2c,
Shared_name mq_name_c2s,
Shared_name mq_name_s2c,
Error_code err_code 
)
private

Helper for create_channel_and_resources(), invoked and compiled if and only if S_MQS_ENABLED, that creates the underlying client->server and server->client MQs and local handles thereto, and outputs these things via out-args.

On failure undoes everything it was able to do and returns false; else returns true.

Parameters
mq_c2sOn success this is the handle to newly creates client->server unidirectional MQ for the new channel.
mq_s2cLike the preceding but opposite-direction (server->client).
mq_name_c2sName for mq_c2s.
mq_name_s2cName for mq_s2c.
err_codeIf false returned, this is the (truthy) reason code.
Returns
true on success; false on failure.

Definition at line 1485 of file server_session_impl.hpp.

References ipc::session::build_conventional_shared_name(), ipc::util::CREATE_ONLY, ipc::util::Shared_name::ct(), and ipc::util::shared_resource_permissions().

Here is the call graph for this function:

◆ master_channel()

template<schema::MqType S_MQ_TYPE_OR_NONE, bool S_TRANSMIT_NATIVE_HANDLES, typename Mdt_payload , schema::ShmType S_SHM_TYPE_OR_NONE, size_t S_SHM_MAX_HNDL_SZ, bool S_GRACEFUL_FINISH_REQUIRED_V>
Server_session_impl< S_MQ_TYPE_OR_NONE, S_TRANSMIT_NATIVE_HANDLES, Mdt_payload, S_SHM_TYPE_OR_NONE, S_SHM_MAX_HNDL_SZ, S_GRACEFUL_FINISH_REQUIRED_V >::Master_structured_channel * ipc::session::Server_session_impl< S_MQ_TYPE_OR_NONE, S_TRANSMIT_NATIVE_HANDLES, Mdt_payload, S_SHM_TYPE_OR_NONE, S_SHM_MAX_HNDL_SZ, S_GRACEFUL_FINISH_REQUIRED_V >::master_channel
protected

Utility for sub-classes: provides ability to do work on the session master channel after our async_accept_log_in() succeeds, but before the sub-classed wrapper of its on-done handler succeeds.

This is pushing my (ygoldfel) (and from coding guide) suggestion to avoid unrestricted protected access to data members. It still "feels" okay but.... Hmmm.

Returns
See above.

Definition at line 2195 of file server_session_impl.hpp.

◆ master_channel_const()

template<schema::MqType S_MQ_TYPE_OR_NONE, bool S_TRANSMIT_NATIVE_HANDLES, typename Mdt_payload , schema::ShmType S_SHM_TYPE_OR_NONE, size_t S_SHM_MAX_HNDL_SZ, bool S_GRACEFUL_FINISH_REQUIRED_V>
const Server_session_impl< S_MQ_TYPE_OR_NONE, S_TRANSMIT_NATIVE_HANDLES, Mdt_payload, S_SHM_TYPE_OR_NONE, S_SHM_MAX_HNDL_SZ, S_GRACEFUL_FINISH_REQUIRED_V >::Master_structured_channel & ipc::session::Server_session_impl< S_MQ_TYPE_OR_NONE, S_TRANSMIT_NATIVE_HANDLES, Mdt_payload, S_SHM_TYPE_OR_NONE, S_SHM_MAX_HNDL_SZ, S_GRACEFUL_FINISH_REQUIRED_V >::master_channel_const
protected

Analogous to Client_session_impl::master_channel_const().

See that doc header.

Returns
See above.

Definition at line 2201 of file server_session_impl.hpp.

◆ mdt_builder()

template<schema::MqType S_MQ_TYPE_OR_NONE, bool S_TRANSMIT_NATIVE_HANDLES, typename Mdt_payload , schema::ShmType S_SHM_TYPE_OR_NONE, size_t S_SHM_MAX_HNDL_SZ, bool S_GRACEFUL_FINISH_REQUIRED_V>
Server_session_impl< S_MQ_TYPE_OR_NONE, S_TRANSMIT_NATIVE_HANDLES, Mdt_payload, S_SHM_TYPE_OR_NONE, S_SHM_MAX_HNDL_SZ, S_GRACEFUL_FINISH_REQUIRED_V >::Mdt_builder_ptr ipc::session::Server_session_impl< S_MQ_TYPE_OR_NONE, S_TRANSMIT_NATIVE_HANDLES, Mdt_payload, S_SHM_TYPE_OR_NONE, S_SHM_MAX_HNDL_SZ, S_GRACEFUL_FINISH_REQUIRED_V >::mdt_builder

See Server_session_mv counterpart.

Returns
See Server_session_mv counterpart.

Definition at line 985 of file server_session_impl.hpp.

References ipc::util::Shared_name::str().

Here is the call graph for this function:

◆ on_master_channel_error()

template<schema::MqType S_MQ_TYPE_OR_NONE, bool S_TRANSMIT_NATIVE_HANDLES, typename Mdt_payload , schema::ShmType S_SHM_TYPE_OR_NONE, size_t S_SHM_MAX_HNDL_SZ, bool S_GRACEFUL_FINISH_REQUIRED_V>
void ipc::session::Server_session_impl< S_MQ_TYPE_OR_NONE, S_TRANSMIT_NATIVE_HANDLES, Mdt_payload, S_SHM_TYPE_OR_NONE, S_SHM_MAX_HNDL_SZ, S_GRACEFUL_FINISH_REQUIRED_V >::on_master_channel_error ( const Error_code err_code)
private

In thread W, handler for m_master_channel indicating incoming-direction channel-hosing error.

It is possible that m_master_channel has been .reset() in the meantime, by seeing log-in failure in on_master_channel_open_channel_req(), and no longer exists.

Parameters
err_codeThe non-success Error_code from transport::struc::Channel.

Definition at line 2109 of file server_session_impl.hpp.

◆ on_master_channel_open_channel_req()

template<schema::MqType S_MQ_TYPE_OR_NONE, bool S_TRANSMIT_NATIVE_HANDLES, typename Mdt_payload , schema::ShmType S_SHM_TYPE_OR_NONE, size_t S_SHM_MAX_HNDL_SZ, bool S_GRACEFUL_FINISH_REQUIRED_V>
void ipc::session::Server_session_impl< S_MQ_TYPE_OR_NONE, S_TRANSMIT_NATIVE_HANDLES, Mdt_payload, S_SHM_TYPE_OR_NONE, S_SHM_MAX_HNDL_SZ, S_GRACEFUL_FINISH_REQUIRED_V >::on_master_channel_open_channel_req ( typename Master_structured_channel::Msg_in_ptr &&  open_channel_req)
private

In thread W, handler for m_master_channel receiving a passive-open (a/k/a open-channel-to-server) request.

If there is no issue with this request, and we're able to sync-send the open-channel response to that effect, this shall fire on-passive-open handler, giving it a new Channel_obj in PEER state + metadata. If there is a problem, then it's not a session-hosing situation; local user is none-the-wiser; except that if the send() reveals a new error, then it is a session-hosing situation, and local user is informed via on-error handler.

Parameters
open_channel_reqThe request in-message from transport::struc::Channel.

Definition at line 1243 of file server_session_impl.hpp.

References ipc::util::Shared_name::empty(), and ipc::util::Shared_name::str().

Here is the call graph for this function:

◆ open_channel() [1/2]

template<schema::MqType S_MQ_TYPE_OR_NONE, bool S_TRANSMIT_NATIVE_HANDLES, typename Mdt_payload , schema::ShmType S_SHM_TYPE_OR_NONE, size_t S_SHM_MAX_HNDL_SZ, bool S_GRACEFUL_FINISH_REQUIRED_V>
bool ipc::session::Server_session_impl< S_MQ_TYPE_OR_NONE, S_TRANSMIT_NATIVE_HANDLES, Mdt_payload, S_SHM_TYPE_OR_NONE, S_SHM_MAX_HNDL_SZ, S_GRACEFUL_FINISH_REQUIRED_V >::open_channel ( Channel_obj target_channel,
const Mdt_builder_ptr mdt,
Error_code err_code = 0 
)

See Server_session_mv counterpart.

Parameters
target_channelSee Server_session_mv counterpart.
mdtSee Server_session_mv counterpart.
err_codeSee Server_session_mv counterpart.
Returns
See Server_session_mv counterpart.

Definition at line 1074 of file server_session_impl.hpp.

References ipc::session::Server_session_impl< S_MQ_TYPE_OR_NONE, S_TRANSMIT_NATIVE_HANDLES, Mdt_payload, S_SHM_TYPE_OR_NONE, S_SHM_MAX_HNDL_SZ, S_GRACEFUL_FINISH_REQUIRED_V >::open_channel(), ipc::session::error::S_SESSION_OPEN_CHANNEL_ACTIVE_TIMEOUT, ipc::session::error::S_SESSION_OPEN_CHANNEL_REMOTE_PEER_REJECTED_PASSIVE_OPEN, ipc::session::error::S_SESSION_OPEN_CHANNEL_SERVER_CANNOT_PROCEED_RESOURCE_UNAVAILABLE, and ipc::transport::error::S_TIMEOUT.

Referenced by ipc::session::Server_session_impl< S_MQ_TYPE_OR_NONE, S_TRANSMIT_NATIVE_HANDLES, Mdt_payload, S_SHM_TYPE_OR_NONE, S_SHM_MAX_HNDL_SZ, S_GRACEFUL_FINISH_REQUIRED_V >::open_channel().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ open_channel() [2/2]

template<schema::MqType S_MQ_TYPE_OR_NONE, bool S_TRANSMIT_NATIVE_HANDLES, typename Mdt_payload , schema::ShmType S_SHM_TYPE_OR_NONE, size_t S_SHM_MAX_HNDL_SZ, bool S_GRACEFUL_FINISH_REQUIRED_V>
bool ipc::session::Server_session_impl< S_MQ_TYPE_OR_NONE, S_TRANSMIT_NATIVE_HANDLES, Mdt_payload, S_SHM_TYPE_OR_NONE, S_SHM_MAX_HNDL_SZ, S_GRACEFUL_FINISH_REQUIRED_V >::open_channel ( Channel_obj target_channel,
Error_code err_code = 0 
)

See Server_session_mv counterpart.

Parameters
target_channelSee Server_session_mv counterpart.
err_codeSee Server_session_mv counterpart.
Returns
See Server_session_mv counterpart.

Definition at line 1236 of file server_session_impl.hpp.

◆ session_token()

template<schema::MqType S_MQ_TYPE_OR_NONE, bool S_TRANSMIT_NATIVE_HANDLES, typename Mdt_payload , schema::ShmType S_SHM_TYPE_OR_NONE, size_t S_SHM_MAX_HNDL_SZ, bool S_GRACEFUL_FINISH_REQUIRED_V>
const Session_token & ipc::session::Server_session_impl< S_MQ_TYPE_OR_NONE, S_TRANSMIT_NATIVE_HANDLES, Mdt_payload, S_SHM_TYPE_OR_NONE, S_SHM_MAX_HNDL_SZ, S_GRACEFUL_FINISH_REQUIRED_V >::session_token

See Server_session_mv counterpart.

Returns
See Server_session_mv counterpart.

Definition at line 951 of file server_session_impl.hpp.

References ipc::transport::struc::NULL_SESSION_TOKEN.

◆ sub_class_set_deinit_func()

template<schema::MqType S_MQ_TYPE_OR_NONE, bool S_TRANSMIT_NATIVE_HANDLES, typename Mdt_payload , schema::ShmType S_SHM_TYPE_OR_NONE, size_t S_SHM_MAX_HNDL_SZ, bool S_GRACEFUL_FINISH_REQUIRED_V>
template<typename Task >
void ipc::session::Server_session_impl< S_MQ_TYPE_OR_NONE, S_TRANSMIT_NATIVE_HANDLES, Mdt_payload, S_SHM_TYPE_OR_NONE, S_SHM_MAX_HNDL_SZ, S_GRACEFUL_FINISH_REQUIRED_V >::sub_class_set_deinit_func ( Task &&  task)
protected

Utility for sub-classes: ensures that task() is invoked near the end of *this dtor's execution, from thread U, after thread W is joined, and any async_accept_log_in() on-done handler has fired with operation-aborted code.

It requires being invoked from thread W. (Behavior is undefined otherwise; assertion may trip.)

The value it adds: A long story best told by specific example. See the original use case which is in shm::classic::Server_session_impl::async_accept_log_in(); it sets up certain SHM cleanup steps to occur, when the session ends.

As of this writing this can be invoked 2+ times if desired, but really the spirit of it is to either never call it, or call it exactly once during a certain stage of async_accept_log_in()'s async portion.

Watch out!

At the time task() runs, the calling instance of the sub-class has been destroyed – thus it is, e.g., usually wrong to capture your this in the task lambda, except for logging. get_logger() and get_log_component() (which are immutable state) are still okay to use.

Template Parameters
TaskFunction object invoked as void with no args.
Parameters
tasktask() shall execute before dtor returns.

Definition at line 2183 of file server_session_impl.hpp.

Friends And Related Function Documentation

◆ operator<<()

template<schema::MqType S_MQ_TYPE_OR_NONE, bool S_TRANSMIT_NATIVE_HANDLES, typename Mdt_payload , schema::ShmType S_SHM_TYPE_OR_NONE, size_t S_SHM_MAX_HNDL_SZ, bool S_GRACEFUL_FINISH_REQUIRED_V>
std::ostream & operator<< ( std::ostream &  os,
const Server_session_impl< S_MQ_TYPE_OR_NONE, S_TRANSMIT_NATIVE_HANDLES, Mdt_payload, S_SHM_TYPE_OR_NONE, S_SHM_MAX_HNDL_SZ, S_GRACEFUL_FINISH_REQUIRED_V > &  val 
)
related

Prints string representation of the given Server_session_impl to the given ostream.

Parameters
osStream to which to write.
valObject to serialize.
Returns
os.

Definition at line 2207 of file server_session_impl.hpp.

Member Data Documentation

◆ m_async_worker

template<schema::MqType S_MQ_TYPE_OR_NONE, bool S_TRANSMIT_NATIVE_HANDLES, typename Mdt_payload , schema::ShmType S_SHM_TYPE_OR_NONE, size_t S_SHM_MAX_HNDL_SZ, bool S_GRACEFUL_FINISH_REQUIRED_V>
flow::async::Single_thread_task_loop ipc::session::Server_session_impl< S_MQ_TYPE_OR_NONE, S_TRANSMIT_NATIVE_HANDLES, Mdt_payload, S_SHM_TYPE_OR_NONE, S_SHM_MAX_HNDL_SZ, S_GRACEFUL_FINISH_REQUIRED_V >::m_async_worker
mutableprivate

Worker thread (a/k/a thread W).

Ordering: Should be declared before m_master_channel: It should destruct before the Task_engine onto which its queued-up handlers might post() items destructs prematurely.

Why mutable?

Well, session_token() is const to the user but must .post() which is non-const. This fits the spirit of mutable. I (ygoldfel) think.

Definition at line 643 of file server_session_impl.hpp.

Referenced by ipc::session::Server_session_impl< S_MQ_TYPE_OR_NONE, S_TRANSMIT_NATIVE_HANDLES, Mdt_payload, S_SHM_TYPE_OR_NONE, S_SHM_MAX_HNDL_SZ, S_GRACEFUL_FINISH_REQUIRED_V >::Server_session_impl().

◆ m_deinit_func_or_empty

template<schema::MqType S_MQ_TYPE_OR_NONE, bool S_TRANSMIT_NATIVE_HANDLES, typename Mdt_payload , schema::ShmType S_SHM_TYPE_OR_NONE, size_t S_SHM_MAX_HNDL_SZ, bool S_GRACEFUL_FINISH_REQUIRED_V>
Function<void ()> ipc::session::Server_session_impl< S_MQ_TYPE_OR_NONE, S_TRANSMIT_NATIVE_HANDLES, Mdt_payload, S_SHM_TYPE_OR_NONE, S_SHM_MAX_HNDL_SZ, S_GRACEFUL_FINISH_REQUIRED_V >::m_deinit_func_or_empty
private

See sub_class_set_deinit_func(). .empty() unless that was called at least once.

Definition at line 656 of file server_session_impl.hpp.

◆ m_graceful_finisher

template<schema::MqType S_MQ_TYPE_OR_NONE, bool S_TRANSMIT_NATIVE_HANDLES, typename Mdt_payload , schema::ShmType S_SHM_TYPE_OR_NONE, size_t S_SHM_MAX_HNDL_SZ, bool S_GRACEFUL_FINISH_REQUIRED_V>
std::optional<typename Base::Graceful_finisher> ipc::session::Server_session_impl< S_MQ_TYPE_OR_NONE, S_TRANSMIT_NATIVE_HANDLES, Mdt_payload, S_SHM_TYPE_OR_NONE, S_SHM_MAX_HNDL_SZ, S_GRACEFUL_FINISH_REQUIRED_V >::m_graceful_finisher
private

Null until PEER state is reached, and NULL unless compile-time S_GRACEFUL_FINISH_REQUIRED is true, this is used to block at the start of dtor to synchronize with the opposing Session dtor for safety.

See also
Session_base::Graceful_finisher doc header for all the background ever.

Definition at line 664 of file server_session_impl.hpp.

◆ m_last_actively_opened_channel_id

template<schema::MqType S_MQ_TYPE_OR_NONE, bool S_TRANSMIT_NATIVE_HANDLES, typename Mdt_payload , schema::ShmType S_SHM_TYPE_OR_NONE, size_t S_SHM_MAX_HNDL_SZ, bool S_GRACEFUL_FINISH_REQUIRED_V>
unsigned int ipc::session::Server_session_impl< S_MQ_TYPE_OR_NONE, S_TRANSMIT_NATIVE_HANDLES, Mdt_payload, S_SHM_TYPE_OR_NONE, S_SHM_MAX_HNDL_SZ, S_GRACEFUL_FINISH_REQUIRED_V >::m_last_actively_opened_channel_id
private

◆ m_last_channel_mq_id

template<schema::MqType S_MQ_TYPE_OR_NONE, bool S_TRANSMIT_NATIVE_HANDLES, typename Mdt_payload , schema::ShmType S_SHM_TYPE_OR_NONE, size_t S_SHM_MAX_HNDL_SZ, bool S_GRACEFUL_FINISH_REQUIRED_V>
unsigned int ipc::session::Server_session_impl< S_MQ_TYPE_OR_NONE, S_TRANSMIT_NATIVE_HANDLES, Mdt_payload, S_SHM_TYPE_OR_NONE, S_SHM_MAX_HNDL_SZ, S_GRACEFUL_FINISH_REQUIRED_V >::m_last_channel_mq_id
private

Unique component of MQ names generated by make_channel_mqs() (if relevant; else untouched).

The mechanic of assigning this (1, 2, ...) is same as m_last_passively_opened_channel_id. Note, though, this guy is very much not merely for logging: MQs must have unique names which are transmitted to the other side during the channel-open procedure.

Definition at line 631 of file server_session_impl.hpp.

◆ m_last_passively_opened_channel_id

template<schema::MqType S_MQ_TYPE_OR_NONE, bool S_TRANSMIT_NATIVE_HANDLES, typename Mdt_payload , schema::ShmType S_SHM_TYPE_OR_NONE, size_t S_SHM_MAX_HNDL_SZ, bool S_GRACEFUL_FINISH_REQUIRED_V>
unsigned int ipc::session::Server_session_impl< S_MQ_TYPE_OR_NONE, S_TRANSMIT_NATIVE_HANDLES, Mdt_payload, S_SHM_TYPE_OR_NONE, S_SHM_MAX_HNDL_SZ, S_GRACEFUL_FINISH_REQUIRED_V >::m_last_passively_opened_channel_id
private

◆ m_log_in_on_done_func

template<schema::MqType S_MQ_TYPE_OR_NONE, bool S_TRANSMIT_NATIVE_HANDLES, typename Mdt_payload , schema::ShmType S_SHM_TYPE_OR_NONE, size_t S_SHM_MAX_HNDL_SZ, bool S_GRACEFUL_FINISH_REQUIRED_V>
flow::async::Task_asio_err ipc::session::Server_session_impl< S_MQ_TYPE_OR_NONE, S_TRANSMIT_NATIVE_HANDLES, Mdt_payload, S_SHM_TYPE_OR_NONE, S_SHM_MAX_HNDL_SZ, S_GRACEFUL_FINISH_REQUIRED_V >::m_log_in_on_done_func
private

The on_done_func argument to async_accept_log_in(); .empty() except while the (at most one, ever) async_accept_log_in() is outstanding.

In other words it is assigned at entry at async_accept_log_in() and .clear()ed upon being invoked, indicating either success or failure of the log-in. Reminder: async_accept_log_in() may not be re-attempted.

It may be invoked by dtor, if it does not fire before dtor.

Definition at line 604 of file server_session_impl.hpp.

◆ m_master_channel

template<schema::MqType S_MQ_TYPE_OR_NONE, bool S_TRANSMIT_NATIVE_HANDLES, typename Mdt_payload , schema::ShmType S_SHM_TYPE_OR_NONE, size_t S_SHM_MAX_HNDL_SZ, bool S_GRACEFUL_FINISH_REQUIRED_V>
Master_structured_channel_ptr ipc::session::Server_session_impl< S_MQ_TYPE_OR_NONE, S_TRANSMIT_NATIVE_HANDLES, Mdt_payload, S_SHM_TYPE_OR_NONE, S_SHM_MAX_HNDL_SZ, S_GRACEFUL_FINISH_REQUIRED_V >::m_master_channel
private

The session master channel.

Accessed in thread W only (not protected by mutex).

  • Up to async_accept_log_in(): this is null.
  • When async_accept_log_in() is outstanding: this is not null.
    • If it fails (and it cannot be re-attempted) it is renullified (though it could've been left alone too; realistically dtor is coming soon... maybe reconsider that).
    • Otherwise it remains non-null and immutable until dtor.

Definition at line 653 of file server_session_impl.hpp.

◆ m_master_sock_stm

template<schema::MqType S_MQ_TYPE_OR_NONE, bool S_TRANSMIT_NATIVE_HANDLES, typename Mdt_payload , schema::ShmType S_SHM_TYPE_OR_NONE, size_t S_SHM_MAX_HNDL_SZ, bool S_GRACEFUL_FINISH_REQUIRED_V>
transport::sync_io::Native_socket_stream ipc::session::Server_session_impl< S_MQ_TYPE_OR_NONE, S_TRANSMIT_NATIVE_HANDLES, Mdt_payload, S_SHM_TYPE_OR_NONE, S_SHM_MAX_HNDL_SZ, S_GRACEFUL_FINISH_REQUIRED_V >::m_master_sock_stm
private

The pre-connected (PEER-state) socket stream peer; is non-as-if-default-cted only up to async_accept_log_in(), at which point it is moved-to m_master_channel.

Accessed only the one time, in async_accept_log_in(), and immediately emptied there. As of this writing that's in thread W, but that does not matter much.

Definition at line 611 of file server_session_impl.hpp.

Referenced by ipc::session::Server_session_impl< S_MQ_TYPE_OR_NONE, S_TRANSMIT_NATIVE_HANDLES, Mdt_payload, S_SHM_TYPE_OR_NONE, S_SHM_MAX_HNDL_SZ, S_GRACEFUL_FINISH_REQUIRED_V >::Server_session_impl().

◆ m_pre_init_err_code

template<schema::MqType S_MQ_TYPE_OR_NONE, bool S_TRANSMIT_NATIVE_HANDLES, typename Mdt_payload , schema::ShmType S_SHM_TYPE_OR_NONE, size_t S_SHM_MAX_HNDL_SZ, bool S_GRACEFUL_FINISH_REQUIRED_V>
Error_code ipc::session::Server_session_impl< S_MQ_TYPE_OR_NONE, S_TRANSMIT_NATIVE_HANDLES, Mdt_payload, S_SHM_TYPE_OR_NONE, S_SHM_MAX_HNDL_SZ, S_GRACEFUL_FINISH_REQUIRED_V >::m_pre_init_err_code
private

Unused/falsy except when in almost-PEER state (past successful async_accept_log_in(), before init_handlers() invoked by user), and m_master_channel reports incoming-direction error.

See class doc header for background.

Definition at line 617 of file server_session_impl.hpp.

◆ m_protocol_negotiator

template<schema::MqType S_MQ_TYPE_OR_NONE, bool S_TRANSMIT_NATIVE_HANDLES, typename Mdt_payload , schema::ShmType S_SHM_TYPE_OR_NONE, size_t S_SHM_MAX_HNDL_SZ, bool S_GRACEFUL_FINISH_REQUIRED_V>
transport::Protocol_negotiator ipc::session::Server_session_impl< S_MQ_TYPE_OR_NONE, S_TRANSMIT_NATIVE_HANDLES, Mdt_payload, S_SHM_TYPE_OR_NONE, S_SHM_MAX_HNDL_SZ, S_GRACEFUL_FINISH_REQUIRED_V >::m_protocol_negotiator
private

Handles the protocol negotiation at the start of the pipe, as pertains to algorithms perpetuated by the vanilla ipc::session Session hierarchy.

Outgoing-direction state is touched when assembling LogInReq to send to opposing Server_session. Incoming-direction state is touched/verified at the start of interpreting LogInRsp receiver from there.

See also
transport::Protocol_negotiator doc header for key background on the topic.

Definition at line 584 of file server_session_impl.hpp.

◆ m_protocol_negotiator_aux

template<schema::MqType S_MQ_TYPE_OR_NONE, bool S_TRANSMIT_NATIVE_HANDLES, typename Mdt_payload , schema::ShmType S_SHM_TYPE_OR_NONE, size_t S_SHM_MAX_HNDL_SZ, bool S_GRACEFUL_FINISH_REQUIRED_V>
transport::Protocol_negotiator ipc::session::Server_session_impl< S_MQ_TYPE_OR_NONE, S_TRANSMIT_NATIVE_HANDLES, Mdt_payload, S_SHM_TYPE_OR_NONE, S_SHM_MAX_HNDL_SZ, S_GRACEFUL_FINISH_REQUIRED_V >::m_protocol_negotiator_aux
private

Analogous to m_protocol_negotiator but pertains to algorithms perpetuated by (if relevant) non-vanilla ipc::session Session hierarchy implemented on top of our vanilla ipc::session Session hierarchy.

For example, ipc::session::shm hierarchies can use this to version whatever additional protocol is required to establish SHM things.

See also
transport::Protocol_negotiator doc header for key background on the topic.

Definition at line 594 of file server_session_impl.hpp.

◆ S_GRACEFUL_FINISH_REQUIRED

template<schema::MqType S_MQ_TYPE_OR_NONE, bool S_TRANSMIT_NATIVE_HANDLES, typename Mdt_payload , schema::ShmType S_SHM_TYPE_OR_NONE, size_t S_SHM_MAX_HNDL_SZ, bool S_GRACEFUL_FINISH_REQUIRED_V>
constexpr bool ipc::session::Server_session_impl< S_MQ_TYPE_OR_NONE, S_TRANSMIT_NATIVE_HANDLES, Mdt_payload, S_SHM_TYPE_OR_NONE, S_SHM_MAX_HNDL_SZ, S_GRACEFUL_FINISH_REQUIRED_V >::S_GRACEFUL_FINISH_REQUIRED = S_GRACEFUL_FINISH_REQUIRED_V
staticconstexpr

Short-hand for template parameter knob S_GRACEFUL_FINISH_REQUIRED_V: see class template doc header.

Definition at line 243 of file server_session_impl.hpp.

◆ S_MQS_ENABLED

template<schema::MqType S_MQ_TYPE_OR_NONE, bool S_TRANSMIT_NATIVE_HANDLES, typename Mdt_payload , schema::ShmType S_SHM_TYPE_OR_NONE, size_t S_SHM_MAX_HNDL_SZ, bool S_GRACEFUL_FINISH_REQUIRED_V>
constexpr bool ipc::session::Server_session_impl< S_MQ_TYPE_OR_NONE, S_TRANSMIT_NATIVE_HANDLES, Mdt_payload, S_SHM_TYPE_OR_NONE, S_SHM_MAX_HNDL_SZ, S_GRACEFUL_FINISH_REQUIRED_V >::S_MQS_ENABLED = Base::S_MQS_ENABLED
staticconstexpr

See Server_session_mv counterpart.

Definition at line 237 of file server_session_impl.hpp.

◆ S_SHM_ENABLED

template<schema::MqType S_MQ_TYPE_OR_NONE, bool S_TRANSMIT_NATIVE_HANDLES, typename Mdt_payload , schema::ShmType S_SHM_TYPE_OR_NONE, size_t S_SHM_MAX_HNDL_SZ, bool S_GRACEFUL_FINISH_REQUIRED_V>
constexpr bool ipc::session::Server_session_impl< S_MQ_TYPE_OR_NONE, S_TRANSMIT_NATIVE_HANDLES, Mdt_payload, S_SHM_TYPE_OR_NONE, S_SHM_MAX_HNDL_SZ, S_GRACEFUL_FINISH_REQUIRED_V >::S_SHM_ENABLED = S_SHM_TYPE != schema::ShmType::NONE
staticconstexpr

See Session_mv counterpart.

Definition at line 231 of file server_session_impl.hpp.

◆ S_SHM_TYPE

template<schema::MqType S_MQ_TYPE_OR_NONE, bool S_TRANSMIT_NATIVE_HANDLES, typename Mdt_payload , schema::ShmType S_SHM_TYPE_OR_NONE, size_t S_SHM_MAX_HNDL_SZ, bool S_GRACEFUL_FINISH_REQUIRED_V>
constexpr schema::ShmType ipc::session::Server_session_impl< S_MQ_TYPE_OR_NONE, S_TRANSMIT_NATIVE_HANDLES, Mdt_payload, S_SHM_TYPE_OR_NONE, S_SHM_MAX_HNDL_SZ, S_GRACEFUL_FINISH_REQUIRED_V >::S_SHM_TYPE = S_SHM_TYPE_OR_NONE
staticconstexpr

See Session_mv counterpart.

Definition at line 228 of file server_session_impl.hpp.

◆ S_SOCKET_STREAM_ENABLED

template<schema::MqType S_MQ_TYPE_OR_NONE, bool S_TRANSMIT_NATIVE_HANDLES, typename Mdt_payload , schema::ShmType S_SHM_TYPE_OR_NONE, size_t S_SHM_MAX_HNDL_SZ, bool S_GRACEFUL_FINISH_REQUIRED_V>
constexpr bool ipc::session::Server_session_impl< S_MQ_TYPE_OR_NONE, S_TRANSMIT_NATIVE_HANDLES, Mdt_payload, S_SHM_TYPE_OR_NONE, S_SHM_MAX_HNDL_SZ, S_GRACEFUL_FINISH_REQUIRED_V >::S_SOCKET_STREAM_ENABLED = Base::S_SOCKET_STREAM_ENABLED
staticconstexpr

See Server_session_mv counterpart.

Definition at line 240 of file server_session_impl.hpp.


The documentation for this class was generated from the following files: