27  = boost::chrono::seconds(20);
 
   36  m_classic_data(logger_ptr, sock),
 
   38  m_rtt_min(S_INIT_RTT_MIN),
 
   52        [[maybe_unused]] 
const size_t bytes, [[maybe_unused]] 
const size_t sent_cwnd_bytes) 
 
   54  using boost::chrono::ceil;
 
   55  using boost::chrono::round;
 
   56  using boost::chrono::milliseconds;
 
   77    FLOW_LOG_TRACE(
"cong_ctl|bw_est [" << sock << 
"] update: RTT event; reset rtt_min " 
   78                   "to [" << round<milliseconds>(
m_rtt_min) << 
"].");
 
   82    const milliseconds prev_rtt_min = round<milliseconds>(
m_rtt_min);
 
   89    FLOW_LOG_TRACE(
"cong_ctl|bw_est [" << sock << 
"] update: RTT event; set rtt_min = " 
   90                   "min[" << prev_rtt_min
 
   91                   << 
", " << round<milliseconds>(packet_rtt_conv) << 
"] " 
   92                   "= [" << round<milliseconds>(
m_rtt_min) << 
"].");
 
   97                                                            [[maybe_unused]] 
size_t packets) 
 
  104                                                                  [[maybe_unused]] 
size_t packets) 
 
  129  FLOW_LOG_TRACE(
"cong_ctl|bw_est [" << sock << 
"] update: loss event; " 
  130                 "set sl_st_thresh=cong_wnd to [" << sock->bytes_blocks_str(new_wnd_bytes) << 
"].");
 
  138                                                                    [[maybe_unused]] 
size_t packets) 
 
  161  FLOW_LOG_TRACE(
"cong_ctl|bw_est [" << sock << 
"] update: DTO event; set sl_st_thresh " 
  162                 "to [" << sock->bytes_blocks_str(new_slow_start_thresh_bytes) << 
"]; " 
  163                 "cong_wnd to minimal value; schedule rtt_min reset.");
 
  194  const n_bytes_t bytes_per_time = sock->m_snd_bandwidth_estimator->bandwidth_bytes_per_time();
 
  196  const size_t floor_wnd_bytes = 2 * sock->max_block_size();
 
  197  const size_t new_wnd_bytes = max(
size_t(bytes_per_time * 
m_rtt_min.count()),
 
  200  FLOW_LOG_TRACE(
"cong_ctl|bw_est [" << sock << 
"] info: window calculation: wnd " 
  201                 "= bw x rtt_min = [" << sock->bytes_blocks_str(
size_t(bytes_per_time)) << 
"] bytes " 
  202                 "per [" << Time_unit(1) << 
"] x [" << 
m_rtt_min << 
"] " 
  203                 "(subject to floor [" << sock->bytes_blocks_str(floor_wnd_bytes) << 
"]) " 
  204                 "= [" << sock->bytes_blocks_str(new_wnd_bytes) << 
"].");
 
  206  return new_wnd_bytes;
 
Interface that the user should implement, passing the implementing Logger into logging classes (Flow'...
void on_drop_timeout(size_t new_slow_start_thresh_bytes)
Adjust state, including CWND and SSTHRESH, assuming a Drop Timeout just occurred.
void on_congestion_event(size_t new_slow_start_thresh_bytes, size_t new_cong_wnd_bytes)
Sets internally stored SSHTRESH and CWND to the given values; appropriately resets internal state so ...
void on_acks(size_t bytes)
Adjusts state, including potentially CWND, based on either "congestion avoidance" or "slow start" alg...
size_t congestion_window_bytes() const
Return current stored CWND value in bytes.
void on_idle_timeout()
Adjust state, namely CWND, assuming an Idle Timeout just occurred.
static const Send_bandwidth_estimator::Time_unit S_INIT_RTT_MIN
The initial value for m_rtt_min, until one RTT measurement comes in.
void on_drop_timeout(size_t bytes, size_t packets) override
Implements Congestion_control_strategy::on_drop_timeout() API.
void on_idle_timeout() override
Implements Congestion_control_strategy::on_idle_timeout() API.
bool m_reset_rtt_min
If true, then when the next RTT measurement comes in, any past measurement should be disregarded,...
void on_acks(size_t bytes, size_t packets) override
Implements Congestion_control_strategy::on_acks() API.
void on_individual_ack(const Fine_duration &packet_rtt, const size_t bytes, const size_t sent_cwnd_bytes) override
Implements Congestion_control_strategy::on_individual_ack() API.
void on_loss_event(size_t bytes, size_t packets) override
Implements Congestion_control_strategy::on_loss_event() API.
size_t congestion_window_adjusted_bytes() const
Returns the best bandwidth/latency-based guess for what the current window (pipe) size should be.
Send_bandwidth_estimator::Time_unit m_rtt_min
The minimum individual packet's RTT observed so far; it should be reset to the next sample if m_reset...
Congestion_control_classic_with_bandwidth_est(log::Logger *logger_ptr, Peer_socket::Const_ptr sock)
Constructs object by setting up logging and saving a pointer to the containing Peer_socket.
Congestion_control_classic_data m_classic_data
The Reno CWND/SSTHRESH-changing engine and CWND/SSTHRESH storage.
size_t congestion_window_bytes() const override
Implements Congestion_control_strategy::congestion_window_bytes() API.
The abstract interface for a per-socket module that determines the socket's congestion control behavi...
Peer_socket::Const_ptr socket() const
Utility for subclasses that returns a handle to the containing Peer_socket.
boost::chrono::milliseconds Time_unit
The primary time unit over which this class reports bandwidth.
uint64_t n_bytes_t
Type that represents the number of bytes, either as an absolute amount or over some time period.
Const_target_ptr Const_ptr
Short-hand for ref-counted pointer to immutable values of type Target_type::element_type (a-la T cons...
#define FLOW_LOG_TRACE(ARG_stream_fragment)
Logs a TRACE message into flow::log::Logger *get_logger() with flow::log::Component get_log_component...
Flow module containing the API and implementation of the Flow network protocol, a TCP-inspired stream...
Fine_clock::duration Fine_duration
A high-res time duration as computed from two Fine_time_pts.