Skip to content

Commit a045be2

Browse files
committed
Reviw suggestions
1 parent 3bc5856 commit a045be2

7 files changed

Lines changed: 11 additions & 9 deletions

File tree

source/flow/tcp/tahoe/tcp_tahoe_cc.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
#include <spdlog/fmt/fmt.h>
44

55
namespace sim {
6-
TcpTahoeCC::TcpTahoeCC(TimeNs a_dealay_threshold, double a_sstresh)
7-
: m_delay_threshold(a_dealay_threshold),
6+
TcpTahoeCC::TcpTahoeCC(TimeNs a_delay_threshold, double a_sstresh)
7+
: m_delay_threshold(a_delay_threshold),
88
m_ssthresh(a_sstresh),
99
m_cwnd(1.0) {}
1010

@@ -28,7 +28,7 @@ TimeNs TcpTahoeCC::get_pacing_delay() const { return TimeNs(0); }
2828
double TcpTahoeCC::get_cwnd() const { return m_cwnd; }
2929

3030
std::string TcpTahoeCC::to_string() const {
31-
return fmt::format("[delay threshold: {}, cwnd: {}, sstresh: {}]",
31+
return fmt::format("[delay threshold: {}, cwnd: {}, ssthresh: {}]",
3232
m_delay_threshold.value(), m_cwnd, m_ssthresh);
3333
}
3434

source/flow/tcp/tahoe/tcp_tahoe_cc.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
namespace sim {
55
class TcpTahoeCC : public ITcpCC {
66
public:
7-
TcpTahoeCC(TimeNs a_dealay_threshold = TimeNs(4000), double a_sstresh = 8);
7+
TcpTahoeCC(TimeNs a_delay_threshold = TimeNs(4000), double a_ssthresh = 8);
88
~TcpTahoeCC() = default;
99

1010
bool on_ack(TimeNs rtt, bool ecn_flag) final;

source/parser/parse_utils.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,5 +39,5 @@ SizeByte parse_buffer_size(const std::string &buffer_size) {
3939
if (unit == "B") {
4040
return SizeByte(value);
4141
}
42-
throw std::runtime_error("Unsupported latency unit: " + unit);
42+
throw std::runtime_error("Unsupported buffer size unit: " + unit);
4343
}

source/parser/parse_utils.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ SpeedGbps parse_speed(const std::string& throughput);
1313
TimeNs parse_latency(const std::string& latency);
1414
SizeByte parse_buffer_size(const std::string& buffer_size);
1515

16-
// Parses node[field_name] using value_parser if node contains filed_name;
16+
// Parses node[field_name] using value_parser if node contains field_name;
1717
// Returns default_value otherwise
1818
template <typename T>
1919
T parse_with_default(const YAML::Node& node, std::string_view field_name,
@@ -22,7 +22,7 @@ T parse_with_default(const YAML::Node& node, std::string_view field_name,
2222
if (!node[field_name]) {
2323
LOG_WARN(
2424
fmt::format("{} does not set ; use default value", field_name));
25-
return default_value;
25+
return std::forward<T>(default_value);
2626
}
2727
return value_parser(node[field_name].as<std::string>());
2828
}

source/units/ld_comparation.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@
33

44
constexpr bool equal(long double value_1, long double value_2) {
55
constexpr long double EPS = 1e-6;
6-
return abs(value_1 - value_2) < EPS;
6+
return std::abs(value_1 - value_2) < EPS;
77
}

source/units/speed.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ class Speed {
2828
return equal(m_bit_per_ns, speed.value_bit_per_ns());
2929
}
3030

31+
constexpr bool operator!=(ThisSpeed speed) { return !(*this == speed); }
32+
3133
private:
3234
long double m_bit_per_ns; // value in bit per nanosecond
3335
};

source/units/time.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ class Time {
6161
return Time<Nanosecond>(m_value_ns * mult);
6262
}
6363

64-
constexpr ThisTime operator++() {
64+
constexpr ThisTime& operator++() {
6565
m_value_ns += TTimeBase::to_nanoseconds_multiplier;
6666
return *this;
6767
}

0 commit comments

Comments
 (0)