Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

control packet support in test::Proxy #802

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

GabrielPerezCSDev
Copy link

@GabrielPerezCSDev GabrielPerezCSDev commented Feb 12, 2025

#772

Summary

This PR adds support for control packet handling in Proxy while maintaining backward compatibility with existing tests.

Changes Implemented

  • Extended Proxy class to handle control packets in addition to source and repair packets.
  • Added an overloaded constructor to allow optional control packet support while preserving the existing test proxy API.
  • Updated write() to use control queue integrated into its current use of source/repair queues to forward control packets.
  • Existing tests and functionality is unaffected

Development Workflow Compliance

  • Targeted develop branch, per project guidelines.
  • Applied code formatting (scons -Q fmt) before submission.
  • Preserved backward compatibility with existing tests.

Notes

  • Control packet support is now integrated into Proxy, following the same queuing mechanism as source and repair packets.

Copy link

🤖 Upon creation, pull request description does not have a link to an issue. If there is a related issue, please add it to the description using any of the supported formats.

@github-actions github-actions bot added the contribution A pull-request by someone else except maintainers label Feb 12, 2025
@gavv gavv added the status: ready for review Pull request can be reviewed label Feb 20, 2025
Copy link
Member

@gavv gavv left a comment

Choose a reason for hiding this comment

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

Thanks for the patch! Some comments.

Comment on lines +124 to +134
Proxy(const roc_endpoint* receiver_source_endp,
const roc_endpoint* receiver_repair_endp,
const roc_endpoint* receiver_control_endp,
size_t n_source_packets,
size_t n_repair_packets,
size_t n_control_packets,
unsigned flags)
: packet_pool_("proxy_packet_pool", arena_)
, buffer_pool_("proxy_buffer_pool", arena_, 2000)
, queue_(packet::ConcurrentQueue::Blocking)
, net_loop_(packet_pool_, buffer_pool_, arena_)
Copy link
Member

Choose a reason for hiding this comment

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

It's not a good idea to copy-paste this huge constructor. If we need two constructors, we'd need to extract common code into a method and reuse it.

However, in this case I think it's better to have just one constructor and pass NULL for control endpoint in tests that don't use it. It's better to make it explicit.

I saw your message about backwards compatibility but didn't have a chance to answer before you opened PR, sorry. We don't need to preserve compatibility here and want to update tests instead.

Comment on lines +257 to +259
const roc_endpoint* control_endpoint() const {
return input_control_endp_;
}
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
const roc_endpoint* control_endpoint() const {
return input_control_endp_;
}
const roc_endpoint* control_endpoint() const {
CHECK(input_control_endp_);
return input_control_endp_;
}

Let's make it fail early if trying to use control endpoint when it's not configured.

const roc_endpoint* receiver_control_endp,
size_t n_source_packets,
size_t n_repair_packets,
size_t n_control_packets,
Copy link
Member

Choose a reason for hiding this comment

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

n_control_packets is not a thing. source and repair packets are grouped into a FEC block, but control packets are not part of any block. We can just remove this parameter.

Comment on lines -189 to +319
const size_t block_pos = pos_ % (n_source_packets_ + n_repair_packets_);
const size_t block_pos =
pos_ % (n_source_packets_ + n_repair_packets_ + n_control_packets_);
Copy link
Member

Choose a reason for hiding this comment

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

As mentioned above, n_control_packets_ doesn't make sense, let's remove it. We can just never drop control packets for now, if we'll ever need it, we can add separate flag for that.

Comment on lines 306 to 186
if (pp->udp()->dst_addr == recv_source_config_.bind_address) {
pp->udp()->dst_addr = receiver_source_endp_;
LONGS_EQUAL(status::StatusOK, source_queue_.write(pp));
} else if (pp->udp()->dst_addr == recv_control_config_.bind_address) {
pp->udp()->dst_addr = receiver_control_endp_;
LONGS_EQUAL(status::StatusOK, control_queue_.write(pp));
} else {
pp->udp()->dst_addr = receiver_repair_endp_;
LONGS_EQUAL(status::StatusOK, repair_queue_.write(pp));
}
Copy link
Member

Choose a reason for hiding this comment

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

nitpick: let's reorder branches in a familiar way: source, repair, control.

@gavv
Copy link
Member

gavv commented Feb 23, 2025

The big part missing from the PR is bi-directional proxying of the control packets - control packets are sent in two directions, unlike source and repair packets. Actually that's the most important part of this feature (the rest is more straightforward), please read issue text in #772.

@gavv gavv added status: needs revision Pull request should be revised by its author and removed status: ready for review Pull request can be reviewed labels Feb 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contribution A pull-request by someone else except maintainers status: needs revision Pull request should be revised by its author
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants