46 using Ptr = boost::shared_ptr<Peer_socket>;
120 template<
typename Rep,
typename Period,
typename Mutable_buffer_sequence,
typename Handler>
122 const boost::chrono::duration<Rep, Period>& max_wait,
123 Handler&& on_result);
150 template<
typename Rep,
typename Period,
typename Handler>
152 const boost::chrono::duration<Rep, Period>& max_wait,
153 Handler&& on_result);
168 template<
typename Mutable_buffer_sequence,
typename Handler>
169 void async_receive(
const Mutable_buffer_sequence& target, Handler&& on_result);
180 template<
typename Handler>
181 void async_receive(
const boost::asio::null_buffers&, Handler&& on_result);
211 template<
typename Rep,
typename Period,
typename Const_buffer_sequence,
typename Handler>
212 void async_send(
const Const_buffer_sequence& source,
213 const boost::chrono::duration<Rep, Period>& max_wait,
214 Handler&& on_result);
241 template<
typename Rep,
typename Period,
typename Handler>
242 void async_send(
const boost::asio::null_buffers&,
243 const boost::chrono::duration<Rep, Period>& max_wait,
244 Handler&& on_result);
259 template<
typename Const_buffer_sequence,
typename Handler>
260 void async_send(
const Const_buffer_sequence& source, Handler&& on_result);
271 template<
typename Handler>
272 void async_send(
const boost::asio::null_buffers&, Handler&& on_result);
397 template<
typename Handler>
410template<
typename Rep,
typename Period,
typename Mutable_buffer_sequence,
typename Handler>
412 const boost::chrono::duration<Rep, Period>& max_wait,
415 assert(target.begin() != target.end());
421template<
typename Rep,
typename Period,
typename Handler>
423 const boost::chrono::duration<Rep, Period>& max_wait,
430template<
typename Mutable_buffer_sequence,
typename Handler>
434 assert(target.begin() != target.end());
439template<
typename Handler>
445template<
typename Rep,
typename Period,
typename Const_buffer_sequence,
typename Handler>
447 const boost::chrono::duration<Rep, Period>& max_wait,
450 assert(source.begin() != source.end());
456template<
typename Rep,
typename Period,
typename Handler>
458 const boost::chrono::duration<Rep, Period>& max_wait,
465template<
typename Const_buffer_sequence,
typename Handler>
469 assert(source.begin() != source.end());
474template<
typename Handler>
476 (
const boost::asio::null_buffers&,
482template<
typename Handler>
485 using boost::asio::post;
486 using boost::asio::bind_executor;
487 using boost::asio::get_associated_executor;
511 return [
this, on_result = std::move(on_result)]
512 (
const Error_code& err_code,
size_t op_result)
516 const auto executor = get_associated_executor(on_result);
518 bind_executor(executor,
519 [err_code, op_result, on_result = std::move(on_result)]
521 on_result(err_code, op_result);
Interface that the user should implement, passing the implementing Logger into logging classes (Flow'...
An object of this class is a single Flow-protocol networking node, in the sense that: (1) it has a di...
A peer (non-server) socket operating over the Flow network protocol, with optional stream-of-bytes an...
A subclass of net_flow::Node that adds the ability to easily and directly use net_flow sockets in gen...
A net_flow::Peer_socket that adds integration with boost.asio.
~Peer_socket() override
Boring virtual destructor as in superclass. See notes there.
void set_async_task_engine(util::Task_engine *target_async_task_engine)
Overwrites the value to be returned by next async_task_engine().
static Ptr cast(net_flow::Peer_socket::Ptr sock)
Convenience method that polymorphically casts from net_flow::Peer_socket::Ptr to subclass pointer net...
util::Task_engine * async_task_engine()
Pointer (possibly null) for the flow::util::Task_engine used by any coming async_*() I/O calls.
void async_send(const Const_buffer_sequence &source, const boost::chrono::duration< Rep, Period > &max_wait, Handler &&on_result)
boost.asio-style asynchronous version that essentially performs non-null_buffers net_flow::Peer_socke...
boost::shared_ptr< Peer_socket > Ptr
Short-hand for shared_ptr to Peer_socket.
boost::shared_ptr< Target_bufs > Target_bufs_ptr
Short-hand for a low-cost-copyable smart pointer of Target_bufs.
std::vector< boost::asio::mutable_buffer > Target_bufs
Short-hand for the Mutable_buffer_sequence concrete type for class-internal code.
const util::Task_engine & async_task_engine_cref() const
Read-only version of async_task_engine().
util::Task_engine * m_target_task_engine
See async_task_engine().
friend std::ostream & operator<<(std::ostream &os, const Peer_socket *sock)
Prints string representation of given socket to given standard ostream and returns the latter.
void async_receive_impl(Target_bufs_ptr target, Handler_func &&on_result, const Fine_time_pt &wait_until)
De-templated implementation of all async_receive() methods.
void async_receive(const Mutable_buffer_sequence &target, const boost::chrono::duration< Rep, Period > &max_wait, Handler &&on_result)
boost.asio-style asynchronous version that essentially performs non-null_buffers net_flow::Peer_socke...
std::vector< boost::asio::const_buffer > Source_bufs
Short-hand for the Const_buffer_sequence concrete type for class-internal code.
Handler_func handler_func(Handler &&on_result)
Returns a functor that essentially performs post() on_result onto *async_task_engine() in a way suita...
Node * node_or_post_error(Handler_func &&on_result)
Helper that returns the net_flow::asio::Node that generated *this; unless *this is closed; in which c...
void async_send_impl(Source_bufs_ptr source, Handler_func &&on_result, const Fine_time_pt &wait_until)
De-templated implementation of all async_send() methods.
Peer_socket(log::Logger *logger_ptr, util::Task_engine *task_engine, const Peer_socket_options &opts)
Constructs object.
boost::shared_ptr< Source_bufs > Source_bufs_ptr
Short-hand for a low-cost-copyable smart pointer of Source_bufs.
boost::shared_ptr< Peer_socket > Ptr
Short-hand for ref-counted pointer to mutable values of type Target_type::element_type (a-la T*).
Contains classes that add boost.asio integration to the main Flow-protocol classes such as net_flow::...
Fine_time_pt chrono_duration_from_now_to_fine_time_pt(const boost::chrono::duration< Rep, Period > &dur)
Helper that takes a non-negative duration of arbitrary precision/period and converts it to Fine_durat...
boost::asio::io_service Task_engine
Short-hand for boost.asio event service, the central class of boost.asio.
boost::system::error_code Error_code
Short-hand for a boost.system error code (which basically encapsulates an integer/enum error code and...
Fine_clock::time_point Fine_time_pt
A high-res time point as returned by Fine_clock::now() and suitable for precise time math in general.
A set of low-level options affecting a single Peer_socket.