Skip to content

Conversation

@PaulRalnikov
Copy link
Collaborator

closes #496

Copy link
Contributor

@ArtyomPeshkov ArtyomPeshkov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move AckInfo to utils and add on_ack overload
Think about MPLB packet distribution (delays management)

Copy link
Contributor

@Az3git Az3git left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not all

flow_weak.lock()->send(
std::vector<PacketInfo>(1, std::move(packet_info)));
});
m_packets_in_flight++;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

m_packets_in_flight increases but does not decrease anywhere

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed with your suggestion abobe

std::weak_ptr<SingleCCMplb> mplb_weak = shared_from_this();
PacketCallback packet_callback = [observer, mplb_weak,
flow_weak](PacketAckInfo info) {
observer->on_single_callback();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the CallbackObserver calls the final callback() on the last packet, the custom callback may be triggered before the CC/delivered/inflight update of the last packet. This can break tests/logic if the user immediately looks at get_context() in the callback.

Please check it

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good one, will be changed

Copy link
Contributor

@Az3git Az3git left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

// returns true if congestion detected; false otherwice
virtual void on_ack(TimeNs rtt, TimeNs avg_rtt, bool ecn_flag) = 0;

virtual void on_ack(PacketAckInfo info) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
virtual void on_ack(PacketAckInfo info) {
virtual void on_ack(const PacketAckInfo& info) {

Copy link
Collaborator Author

@PaulRalnikov PaulRalnikov Jan 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is not significant here - size of PacketAckInfo is too camll (just two doubles + bool)

packet_info.packet_size;
}
flow_weak.lock()->send(
std::vector<PacketInfo>(1, std::move(packet_info)));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

vector have this signature - vector(size_type count, const T& value);
Suggestion:

std::vector<PacketInfo> packets;
packets.push_back(std::move(packet_info));
flow->send(std::move(packets));

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think your variant is abbigious, but mine is not perfect too. I will replace it with std::vector<PacktInfo>({packet_info})

if (mplb_weak.expired()) {
LOG_ERROR(
"MPLB pointer expired; could not increase sent data "
"size");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

miss return; ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, we may use just code section flow_weak.lock()->send(...) if mplb pointer is expired

#include "connection/flow/tcp/i_tcp_cc.hpp"

namespace test {
class CCMock : public sim::ITcpCC {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need override for methods

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No:)

: m_flows(a_flows) {};

virtual std::shared_ptr<sim::INewFlow> choose_flow() final {
return *m_flows.begin();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If m_flows is empty — UB.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Its just a mock so its not so important

PaulRalnikov and others added 2 commits January 28, 2026 16:19
Co-authored-by: Alexey Zharkov <62723911+Az3git@users.noreply.github.com>
@PaulRalnikov PaulRalnikov marked this pull request as ready for review January 28, 2026 13:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

FEAT: MPLB with single CC

4 participants