24#include <boost/enable_shared_from_this.hpp>
149 public boost::enable_shared_from_this<Drop_timer>,
151 private boost::noncopyable
207 const Function<
void (
bool drop_all_packets)>& timer_fired);
327 const Function<
void (
bool drop_all_packets)>& timer_fired);
Convenience class that simply stores a Logger and/or Component passed into a constructor; and returns...
Interface that the user should implement, passing the implementing Logger into logging classes (Flow'...
Internal net_flow class that maintains the Drop Timer for DATA packet(s) to have been sent out over a...
Sequence_number::seq_num_t packet_id_t
Type to uniquely identify a packet sent over the wire in the socket to which this Drop_timer applies.
packet_id_t m_during_events_newest_acked_packet
During the time period starting with the last start_contemporaneous_events() call and ending with the...
Function< void(const Error_code &err_code)> m_timer_failure
Called on error. See Drop_timer constructor.
packet_id_t m_at_events_start_oldest_flying_packet
The packet ID of the least recently sent In-flight packet at last start_contemporaneous_events() call...
void timer_failure(Ptr prevent_destruction, const Error_code &err_code)
Called by boost.asio after we post it, in the event of some timer error.
void end_contemporaneous_events()
Finishes the group started by start start_contemporaneous_events().
void on_ack(packet_id_t packet_id)
Indicates that a packet for which on_packet_in_flight() was called has just been validly acked.
void start_timer()
Starts a new wait on the timer, so that is it asynchronously triggered according to the current DTO v...
void on_packet_no_longer_in_flight(packet_id_t packet_id)
Indicates that a packet for which on_packet_in_flight() was called is now no longer considered In-fli...
static Ptr create_drop_timer(log::Logger *logger_ptr, util::Task_engine *node_task_engine, Fine_duration *sock_drop_timeout, Peer_socket::Const_ptr &&sock, const Function< void(const Error_code &err_code)> &timer_failure, const Function< void(bool drop_all_packets)> &timer_fired)
Constructs Drop_timer and returns a ref-counted pointer wrapping it.
const Peer_socket::Const_ptr m_sock
The containing Peer_socket (note that this is read-only access).
std::set< packet_id_t > m_flying_packets
Packet IDs of packets to have been sent over wire and still considered In-flight, ordered from earlie...
Function< void(bool drop_all_packets)> m_timer_fired
Called on Drop Timeout. See Drop_timer constructor.
bool m_timer_running
Is there an active (non-obsolete, not-canceled) asynchronous wait in progress on m_timer?...
Drop_timer(log::Logger *logger, util::Task_engine *node_task_engine, Fine_duration *sock_drop_timeout, Peer_socket::Const_ptr &&sock, const Function< void(const Error_code &err_code)> &timer_failure, const Function< void(bool drop_all_packets)> &timer_fired)
Constructs Drop_timer as described in the factory constructor create_drop_timer().
bool m_done
true if and only if done() has been called. Starts at false, can only change to true.
timer_wait_id_t m_current_wait_id
Unique (within this object) identifier of the last start_timer() call.
void handle_timer_firing(Ptr prevent_destruction, timer_wait_id_t wait_id, const Error_code &sys_err_code)
Called by boost.asio when the Drop Timer fires; disables timer and calls an outside action callback (...
void done()
Causes the Drop_timer to guarantee none of the action callbacks provided at construction will be call...
void start_contemporaneous_events()
Indicates the start of a series of zero or more contemporary on_*() event calls, to be marked as fini...
util::Task_engine & m_node_task_engine
Node::m_task_engine of the containing Node. Used to schedule timer events.
void on_no_packets_in_flight_any_longer()
Equivalent to on_packet_no_longer_in_flight(P), for all P currently In-flight as registered by on_pac...
util::Timer m_timer
The Drop Timer itself.
void disable_timer()
Invalidates the running asynchronous wait on m_timer. Pre-condition: m_timer_running.
uint64_t timer_wait_id_t
The counter type used to distinguish a given start_timer() call from any other such call (for this ob...
Fine_duration & m_sock_drop_timeout
Reference to the containing Peer_socket's Peer_socket::m_snd_drop_timeout data member (= DTO,...
bool m_in_events_group
true if and only if the last start_contemporaneous_events() call exists, and either end_contemporaneo...
void on_packet_in_flight(packet_id_t packet_id)
Indicates that a packet identified by the given unique ID has just been sent over the wire (the low-l...
uint64_t seq_num_t
Raw sequence number type.
Convenience class template that endows the given subclass T with nested aliases Ptr and Const_ptr ali...
boost::shared_ptr< Drop_timer > Ptr
Short-hand for ref-counted pointer to mutable values of type Target_type::element_type (a-la T*).
Const_target_ptr Const_ptr
Short-hand for ref-counted pointer to immutable values of type Target_type::element_type (a-la T cons...
Flow module containing the API and implementation of the Flow network protocol, a TCP-inspired stream...
boost::asio::io_service Task_engine
Short-hand for boost.asio event service, the central class of boost.asio.
boost::asio::basic_waitable_timer< Fine_clock > Timer
boost.asio timer.
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::duration Fine_duration
A high-res time duration as computed from two Fine_time_pts.