Skip to content

Commit b8eea3f

Browse files
tcp: Added getter for RTO in ms in RTTM
1 parent 58d0345 commit b8eea3f

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

api/net/tcp/rttm.hpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,9 @@ struct RTTM {
5757

5858
void stop(bool first = false);
5959

60+
auto rto_ms() const
61+
{ return std::chrono::milliseconds{static_cast<unsigned long>(RTO * 1000)}; }
62+
6063
/*
6164
When the first RTT measurement R is made, the host MUST set
6265
@@ -66,7 +69,7 @@ struct RTTM {
6669
6770
where K = 4.
6871
*/
69-
inline void first_rtt_measurement(duration_t R) {
72+
void first_rtt_measurement(duration_t R) {
7073
SRTT = R;
7174
RTTVAR = R/2;
7275
update_rto();
@@ -89,19 +92,18 @@ struct RTTM {
8992
After the computation, a host MUST update
9093
RTO <- SRTT + max (G, K*RTTVAR)
9194
*/
92-
inline void sub_rtt_measurement(duration_t R) {
95+
void sub_rtt_measurement(duration_t R) {
9396
RTTVAR = (1 - beta) * RTTVAR + beta * std::abs(SRTT-R);
9497
SRTT = (1 - alpha) * SRTT + alpha * R;
9598
update_rto();
9699
}
97100

98-
inline void update_rto() {
101+
void update_rto() {
99102
RTO = std::max(SRTT + std::max(CLOCK_G, K * RTTVAR), 1.0);
100103
debug2("<TCP::Connection::RTO> RTO updated: %ums\n",
101104
(uint32_t)(RTO * 1000));
102105
}
103-
104-
}; // < struct RTTM
106+
} __attribute__((packed)); // < struct RTTM
105107

106108
} // < namespace tcp
107109
} // < namespace net

0 commit comments

Comments
 (0)