Skip to content

Commit

Permalink
Add Fetch ctor
Browse files Browse the repository at this point in the history
Summary: There's more gcc weirdness afoot using struct initializer ctors inside coroutines, so just make an explicit constructor.

Reviewed By: NEUDitao

Differential Revision: D67800269

fbshipit-source-id: 5ffcb8e77f09a1e35a63d72cab7c1057cd60614e
  • Loading branch information
afrind authored and facebook-github-bot committed Jan 6, 2025
1 parent a9b28d4 commit f7a5065
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 10 deletions.
16 changes: 16 additions & 0 deletions moxygen/MoQFramer.h
Original file line number Diff line number Diff line change
Expand Up @@ -580,6 +580,22 @@ folly::Expected<MaxSubscribeId, ErrorCode> parseMaxSubscribeId(
size_t length) noexcept;

struct Fetch {
Fetch() = default;
Fetch(
SubscribeID su,
FullTrackName n,
uint8_t p,
GroupOrder g,
AbsoluteLocation st,
AbsoluteLocation e,
std::vector<TrackRequestParameter> pa = {})
: subscribeID(su),
fullTrackName(std::move(n)),
priority(p),
groupOrder(g),
start(st),
end(e),
params(std::move(pa)) {}
SubscribeID subscribeID;
FullTrackName fullTrackName;
uint8_t priority;
Expand Down
14 changes: 7 additions & 7 deletions moxygen/samples/text-client/MoQTextClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,13 +155,13 @@ class MoQTextClient {
fetchTextHandler_ = std::make_shared<ObjectReceiver>(
ObjectReceiver::FETCH, &textHandler_);
auto fetchTrack = co_await moqClient_.moqSession_->fetch(
{SubscribeID(0),
sub.fullTrackName,
sub.priority,
sub.groupOrder,
range.start,
fetchEnd,
{}},
Fetch(
SubscribeID(0),
sub.fullTrackName,
sub.priority,
sub.groupOrder,
range.start,
fetchEnd),
fetchTextHandler_);
if (fetchTrack.hasError()) {
XLOG(ERR) << "Fetch failed err=" << fetchTrack.error().errorCode
Expand Down
5 changes: 2 additions & 3 deletions moxygen/test/MoQSessionTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -218,14 +218,13 @@ namespace {
// GCC barfs when using struct brace initializers inside a coroutine?
// Helper function to make a Fetch request
Fetch getFetch(AbsoluteLocation start, AbsoluteLocation end) {
return Fetch{
return Fetch(
SubscribeID(0),
FullTrackName{TrackNamespace{{"foo"}}, "bar"},
0,
GroupOrder::OldestFirst,
start,
end,
{}};
end);
}
} // namespace

Expand Down

0 comments on commit f7a5065

Please sign in to comment.