Flow-IPC 1.0.2
Flow-IPC project: Full implementation reference.
|
Internal type containing data and types common to internal types Server_session_impl and Client_session_impl which are the respective true cores of Server_session and Client_session respectively. More...
#include <session_base.hpp>
Classes | |
class | Graceful_finisher |
Optional to use by subclasses, this operates a simple state machine that carries out a graceful-session-end handshake procedure. More... | |
Public Types | |
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 | |
const Shared_name & | srv_namespace () const |
See Server_session_impl, Client_session_impl. More... | |
const Shared_name & | cli_namespace () const |
See Server_session_impl, Client_session_impl. More... | |
const Client_app * | cli_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 Member Functions | |
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 | |
const Server_app & | m_srv_app_ref |
Reference to Server_app (referring to local process in Server_session_impl, opposing process in Client_session_impl). More... | |
Static Public Attributes | |
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 = 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 | |
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_func & | on_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... | |
Static Protected Attributes | |
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... | |
Private Attributes | |
std::atomic< const Client_app * > | m_cli_app_ptr |
See cli_app_ptr(). More... | |
Shared_name | m_srv_namespace |
See srv_namespace(). More... | |
Shared_name | m_cli_namespace |
See cli_namespace(). More... | |
flow::async::Task_asio_err | m_on_err_func |
See set_on_err_func(). More... | |
On_passive_open_channel_func | m_on_passive_open_channel_func_or_empty |
See on_passive_open_channel_func_or_empty(). More... | |
Error_code | m_peer_state_err_code_or_ok |
Starts falsy; becomes forever truthy (with a specific Error_code that will not change thereafter) once hose() is called (with that truthy value). More... | |
Internal type containing data and types common to internal types Server_session_impl and Client_session_impl which are the respective true cores of Server_session and Client_session respectively.
A Server_session_impl and Client_session_impl share many basic properties, some public. For example consider that a Server_session_impl on this side has 1 counterpart Client_session_impl on the other side (or vice versa); for both it is salient which Server_app is on the server side and which Client_app is on the client side. In terms of types/constants, on each side the two Session objects must be identically configured via various template params which results in non-trivial type aliases like the highly significant Channel_obj, exposed in the Session concept, and constants like S_SOCKET_STREAM_ENABLED.
Regarding data: an operational (PEER-state) Session (on either end) will need various members to be set before it is indeed in PEER state. This object stores such data, usually unset at first, and features protected
setters to invoke once each, until all are set permanently for PEER state.
Session_base also has a protected
inner class, Session_base::Graceful_finisher which certain variations (for which this is necessary) of Server_session_impl and Client_session_impl use to carry out a graceful-session-end handshake procedure. This is here in Session_base – despite being somewhat more algorithmic/stateful than the other stuff here – essentially because the Graceful_finisher (if needed at all) on each side acts completely symmetrically. Other items tend to be (internally) asymmetrical in behavior between Server_session_impl and Client_session_impl (and variants). More info on Session_base::Graceful_finisher in its own doc header.
Mdt_payload | See Server_session, Client_session (or Session concept). |
S_MQ_TYPE_OR_NONE | See Server_session, Client_session. |
S_TRANSMIT_NATIVE_HANDLES | See Server_session, Client_session. |
Definition at line 67 of file session_base.hpp.
using ipc::session::Session_base< S_MQ_TYPE_OR_NONE, S_TRANSMIT_NATIVE_HANDLES, Mdt_payload >::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).
Definition at line 111 of file session_base.hpp.
using ipc::session::Session_base< S_MQ_TYPE_OR_NONE, S_TRANSMIT_NATIVE_HANDLES, Mdt_payload >::Channels = std::vector<Channel_obj> |
See Session_mv. Note: If changed from vector
please update those doc headers too.
Definition at line 122 of file session_base.hpp.
|
protected |
The (internally used) session master channel is a transport::struc::Channel of this concrete type.
Rationale for the chosen knob values:
Mqs_channel
would work fine if S_SOCKET_STREAM_ENABLED is false
. The real reason at least a handles pipe is required is that to establish this channel – unlike subsequent channels in the session – a client-server flow is required. This connection establishment is not possible with MQs, so of the available options only a socket stream would work.Definition at line 352 of file session_base.hpp.
|
protected |
Observer of Master_structured_channel_ptr. See its doc header.
Definition at line 369 of file session_base.hpp.
|
protected |
Handle to Master_structured_channel.
It's a handle at all, because at first and possibly later there may be no session master channel, so a null value is useful. (Though, std::optional
could be used instead.) It's a ref-counted pointer as opposed to unique_ptr
so that it can be observed via Master_structured_channel_observer (weak_ptr
) which is not (and cannot) be available for unique_ptr
. The observing is needed tactically for certain async lambda needs.
Definition at line 366 of file session_base.hpp.
using ipc::session::Session_base< S_MQ_TYPE_OR_NONE, S_TRANSMIT_NATIVE_HANDLES, Mdt_payload >::Mdt_builder = typename transport::struc::schema::Metadata<Mdt_payload_obj>::Builder |
See Session_mv (or Session concept).
Definition at line 132 of file session_base.hpp.
using ipc::session::Session_base< S_MQ_TYPE_OR_NONE, S_TRANSMIT_NATIVE_HANDLES, Mdt_payload >::Mdt_builder_ptr = boost::shared_ptr<Mdt_builder> |
See Session_mv (or Session concept).
Definition at line 136 of file session_base.hpp.
using ipc::session::Session_base< S_MQ_TYPE_OR_NONE, S_TRANSMIT_NATIVE_HANDLES, Mdt_payload >::Mdt_payload_obj = Mdt_payload |
See Session_mv (or Session concept).
Definition at line 125 of file session_base.hpp.
using ipc::session::Session_base< S_MQ_TYPE_OR_NONE, S_TRANSMIT_NATIVE_HANDLES, Mdt_payload >::Mdt_reader_ptr = boost::shared_ptr<typename transport::struc::schema::Metadata<Mdt_payload_obj>::Reader> |
See Session_mv (or Session concept).
Definition at line 128 of file session_base.hpp.
|
protected |
Concrete function type for the on-passive-open handler (if any), used for storage.
Definition at line 372 of file session_base.hpp.
using ipc::session::Session_base< S_MQ_TYPE_OR_NONE, S_TRANSMIT_NATIVE_HANDLES, Mdt_payload >::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
.
Definition at line 103 of file session_base.hpp.
using ipc::session::Session_base< S_MQ_TYPE_OR_NONE, S_TRANSMIT_NATIVE_HANDLES, Mdt_payload >::Structured_msg_builder_config = transport::struc::Heap_fixed_builder::Config |
See Session_mv (or Session concept).
Definition at line 139 of file session_base.hpp.
using ipc::session::Session_base< S_MQ_TYPE_OR_NONE, S_TRANSMIT_NATIVE_HANDLES, Mdt_payload >::Structured_msg_reader_config = transport::struc::Heap_reader::Config |
See Session_mv (or Session concept).
Definition at line 142 of file session_base.hpp.
|
explicitprotected |
Constructs: Client_session_impl form (the user is the one constructing the object, though in NULL state).
The values taken as args are set permanently (undefined behavior/assertion may trip if an attempt is made to modify one via mutator). The remaining values must be set via mutator before PEER state.
cli_app_ref | See cli_app_ptr(). |
srv_app_ref | See m_srv_app_ref. |
on_err_func | On-error handler from user. |
on_passive_open_channel_func_or_empty_arg | On-passive-open handler from user (empty if user wishes the disable passive-opens on this side). |
Definition at line 819 of file session_base.hpp.
|
explicitprotected |
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).
The values taken as args are set permanently (undefined behavior/assertion may trip if an attempt is made to modify one via mutator). The remaining values must be set via mutator before PEER state.
srv_app_ref | See m_srv_app_ref. |
Definition at line 838 of file session_base.hpp.
const Client_app * ipc::session::Session_base< S_MQ_TYPE_OR_NONE, S_TRANSMIT_NATIVE_HANDLES, Mdt_payload >::cli_app_ptr |
See Server_session_impl, Client_session_impl.
However in Session_base this value may be not-yet-set (null), or set (and immutable from then on). Note the value to which we refer is the actual pointer. (The Client_app that is pointed-to, itself, is certainly immutable too.)
This value shall be set from the start in a Client_session_impl but determined during a given Server_session_impl's log-in (the opposing Client_session_impl will transmit the Client_app::m_name). The log-in shall complete the Server_session
's entry to PEER state.
Definition at line 906 of file session_base.hpp.
const Shared_name & ipc::session::Session_base< S_MQ_TYPE_OR_NONE, S_TRANSMIT_NATIVE_HANDLES, Mdt_payload >::cli_namespace |
See Server_session_impl, Client_session_impl.
However in Session_base this value may be not-yet-set (empty), or set (and immutable from then on).
This value shall be generated uniquely (within some context) for each new Server_session
produced by Session_server; and Client_session_impl shall find that out while logging in (last part of entering PEER state).
Definition at line 918 of file session_base.hpp.
fs::path ipc::session::Session_base< S_MQ_TYPE_OR_NONE, S_TRANSMIT_NATIVE_HANDLES, Mdt_payload >::cur_ns_store_absolute_path |
Computes the absolute path to file storing (written by server, read by client) the value for srv_namespace().
The file is located as cur_ns_store_absolute_path().
This may be called anytime.
Definition at line 986 of file session_base.hpp.
References ipc::util::IPC_KERNEL_PERSISTENT_RUN_DIR.
Shared_name ipc::session::Session_base< S_MQ_TYPE_OR_NONE, S_TRANSMIT_NATIVE_HANDLES, Mdt_payload >::cur_ns_store_mutex_absolute_name |
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().
The file is located as cur_ns_store_absolute_path().
This may be called anytime.
Definition at line 953 of file session_base.hpp.
References ipc::session::build_conventional_shared_name(), ipc::util::Shared_name::ct(), ipc::util::Shared_name::S_RESOURCE_TYPE_ID_MUTEX, and ipc::util::Shared_name::S_SENTINEL.
|
static |
See Session_mv::heap_fixed_builder_config() (1-arg).
logger_ptr | See above. |
Definition at line 1020 of file session_base.hpp.
|
static |
See Session_mv::heap_reader_config() (1-arg).
logger_ptr | See above. |
Definition at line 1165 of file session_base.hpp.
|
protected |
Marks this session as hosed for (truthy) reason err_code
; and synchronously invokes on-error handler; only invoke if not already hosed().
This utility is important and has certain pre-conditions (behavior undefined if not met; assertion may trip):
*this
must be in PEER state. In particular on_err_func_set() must return true
.false
.err_code
must be truthy (non-success).err_code | Truthy error. |
Definition at line 937 of file session_base.hpp.
Referenced by ipc::session::Session_base< S_MQ_TYPE_OR_NONE, S_TRANSMIT_NATIVE_HANDLES, Mdt_payload >::Graceful_finisher::Graceful_finisher().
|
protected |
Returns true
if and only if hose() has been called.
If so then m_on_err_func has been executed already. *this
must be in PEER state. In particular on_err_func_set() must return true
.
Definition at line 946 of file session_base.hpp.
Referenced by ipc::session::Session_base< S_MQ_TYPE_OR_NONE, S_TRANSMIT_NATIVE_HANDLES, Mdt_payload >::Graceful_finisher::Graceful_finisher().
|
protected |
Returns true
if and only if set_on_err_func() has been called.
Definition at line 931 of file session_base.hpp.
|
protected |
The on-passive-open handler (may be empty even in final state, meaning user wants passive-opens disabled on this side).
Definition at line 925 of file session_base.hpp.
Shared_name ipc::session::Session_base< S_MQ_TYPE_OR_NONE, S_TRANSMIT_NATIVE_HANDLES, Mdt_payload >::session_master_socket_stream_acceptor_absolute_name |
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.
This must be called no earlier than set_srv_namespace(); otherwise behavior undefined (assertion may trip).
Definition at line 999 of file session_base.hpp.
References ipc::session::build_conventional_shared_name(), ipc::util::Shared_name::ct(), ipc::transport::Native_socket_stream_acceptor::S_RESOURCE_TYPE_ID, and ipc::util::Shared_name::S_SENTINEL.
|
protected |
Sets cli_app_ptr() (do not call if already set).
cli_app_ptr_new | Value. |
Definition at line 857 of file session_base.hpp.
|
protected |
Sets cli_namespace() (do not call if already set).
cli_namespace_new | Value. |
Definition at line 880 of file session_base.hpp.
References ipc::util::Shared_name::S_SENTINEL.
|
protected |
Sets on_err_func() (do not call if already set).
on_err_func_arg | Value. |
Definition at line 897 of file session_base.hpp.
|
protected |
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).
on_passive_open_channel_func | Value. |
Definition at line 890 of file session_base.hpp.
|
protected |
Sets srv_namespace() (do not call if already set).
srv_namespace_new | Value. |
Definition at line 870 of file session_base.hpp.
References ipc::util::Shared_name::S_SENTINEL.
const Shared_name & ipc::session::Session_base< S_MQ_TYPE_OR_NONE, S_TRANSMIT_NATIVE_HANDLES, Mdt_payload >::srv_namespace |
See Server_session_impl, Client_session_impl.
However in Session_base this value may be not-yet-set (empty), or set (and immutable from then on).
This value shall be known and immutable from construction for Server_session_impl, since server namespace – PID as of this writing – can be determined from the start on the server side and applies to every server session that Session_server produces. Client_session_impl, however, determines it at the latest possible moment which is at Client_session_impl::async_connect() time, at which point it needs to determine the PID via PID file.
Definition at line 912 of file session_base.hpp.
|
private |
See cli_app_ptr().
atomic<>
It is for the following specific reason. Consider ostream<<
of *this
. *this
is really either in Client_session_impl or Server_session_impl. In both cases these ostream<<
s access only m_srv_app_ref, which is immutable throughout (so no problem there) and m_cli_app_ptr. For Client_session_impl m_cli_app_ptr is also immutable throughout (so no problem there). For Server_session_impl however it does change in one spot: Server_session_impl::async_accept_log_in() internal async handler for the log-in request shall, on success, call set_cli_app_ptr() and change it from null to non-null. This could cause concurrent access to the data member, even though it's a mere pointer (but we don't count on the alleged "atomicity" of this; it is generally considered not safe).
Now, as of this writing, there's exactly one spot where ostream<<
could be invoked from thread U while it is being assigned in thread W: async_accept_log_in()
is called by our internal code in Session_server and only once; the only thing that can occur in thread U until the log-in response handler is executed is that Server_session_impl dtor is called. Before that dtor stops that thread W, it does print the Server_session_impl once as of this writing. Therefore, out of sheer caution, this guy is atomic<>
. That said there could be other such invocations, as code might change during maintenance in the future, in which case this atomic<>
ness will quietly come in handy.
Definition at line 783 of file session_base.hpp.
|
private |
See cli_namespace().
Definition at line 789 of file session_base.hpp.
|
private |
See set_on_err_func().
Definition at line 792 of file session_base.hpp.
|
private |
See on_passive_open_channel_func_or_empty().
Definition at line 795 of file session_base.hpp.
|
private |
Starts falsy; becomes forever truthy (with a specific Error_code that will not change thereafter) once hose() is called (with that truthy value).
Note hose() may not be called before PEER state, which implies m_on_err_func is non-empty.
See hose() and hosed() doc headers. TL;DR: It is up to the caller to only call those, basically, from thread W only.
Definition at line 806 of file session_base.hpp.
const Server_app& ipc::session::Session_base< S_MQ_TYPE_OR_NONE, S_TRANSMIT_NATIVE_HANDLES, Mdt_payload >::m_srv_app_ref |
Reference to Server_app (referring to local process in Server_session_impl, opposing process in Client_session_impl).
This is known from construction and immutable (both the reference, of course, and the Server_app itself).
Definition at line 243 of file session_base.hpp.
|
private |
See srv_namespace().
Definition at line 786 of file session_base.hpp.
|
staticconstexpr |
See Session_mv.
Definition at line 74 of file session_base.hpp.
|
staticconstexprprotected |
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).
If *this
belongs to Server_session_impl, that's what this is. If it belongs to Client_session_impl, then this is what the opposing process – if they're using the same code! – will have decided.
Our own heap_fixed_builder_config(), forwarded to Session_mv::heap_fixed_builder_config(), similarly uses this constant in a matching way.
true
, then a different (much smaller) MQ message size limit is configured. In that case, also, heap_fixed_builder_config() is not relevant and should not be used.While it looks simple, there is a number of subtleties one must understand if ever considering changing it.
As of this writing the same constant value is used for both types of MQ configurable. The actual value is chosen due to a certain aspect of POSIX MQs (discussed just below); and we reuse it for bipc, though we absolutely do not have to, for simplicity/for lack of better ideas at the moment. It would be possible to bifurcate those two cases if really desired.
By default in Linux POSIX MQs this happens to be the actual limit for # of unread messages – visible in /proc/sys/fs/mqueue/msgsize_max – so we cannot go higher typically. However that file can be modified. For now we assume a typical environment; or at least that it will not go below this typical default. If did try a higher number here, opening of MQs by server will likely emit an error and refuse (Server_session_impl::make_channel_mqs()).
transport::struc::Heap_fixed_builder
-backed for structured messages (via transport::struc::Channel), then the max size is quite important: if a leaf in your message exceeds this size when serialized, it is a fatal error.shm::classic::*_session
), then this constant does not get used (a much smaller value does – so small it would be ~meaningless to decrease it).Heap_fixed_builder
-based use case does matter. If ipc has not yet been released in production, ever, then it's fine (assuming, that is, it'll work in the first place given the aforementioned /proc/sys/...
limit for POSIX MQs). If it has been released then there is an annoying subtlety to consider:Definition at line 321 of file session_base.hpp.
|
staticconstexprprotected |
Internal timeout for open_channel()
.
We initially tried something much less generous, 500ms. It worked fine, but some people encountered the timeout due to unrelated reasons, and it was natural to blame it on the timeout. This much longer timeout should make it obvious, in such a situation, that it's not about some slowness inside Flow-IPC but a pathological application problem – particularly around session-open time. For example not calling Server_session_impl::init_handlers(), or calling it late, as of this writing can cause issues with this.
The downside is it makes Session::open_channel() potentially blocking formally speaking, whereas 500ms could still claim to be non-blocking. It's a matter of perspective really. This value just seems to cause less confusion. We might reconsider the whole thing however.
Definition at line 262 of file session_base.hpp.
|
staticconstexpr |
See Session_mv.
Definition at line 77 of file session_base.hpp.