Skip to content

Commit 19e6c1f

Browse files
committed
Sync ORelay from moxygen relay (21c3597..b426e6c)
Brings ORelay up to date with 9 upstream moxygen commits: - NamespaceSubscriberInfo struct (forward, options, namespacePublishHandle, trackNamespacePrefix) replacing bare bool in sessions map - Draft 16+ bidi stream support in publishNamespace/publishNamespaceDone - trackStatus method (forward to upstream or answer from local forwarder) - publishToSession: remove PublishRequest param - subscribeNamespace: allow empty prefix for draft 16+; store full NamespaceSubscriberInfo; draft 16+ namespace message path - subscribe/publish: setExtensions replacing setGroupOrder/delivery timeout - Remove MoQTrackProperties.h include - 523 new test lines covering all new functionality
1 parent 3239fc8 commit 19e6c1f

3 files changed

Lines changed: 748 additions & 122 deletions

File tree

include/o_rly/ORelay.h

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,9 @@ class ORelay : public moxygen::Publisher,
6161
XLOG(INFO) << "Processing goaway uri=" << goaway.newSessionUri;
6262
}
6363

64+
folly::coro::Task<moxygen::Publisher::TrackStatusResult> trackStatus(moxygen::TrackStatus req
65+
) override;
66+
6467
std::shared_ptr<moxygen::MoQSession> findPublishNamespaceSession(const moxygen::TrackNamespace& ns
6568
);
6669

@@ -76,8 +79,8 @@ class ORelay : public moxygen::Publisher,
7679

7780
// Test accessor: check if a publish exists and return node/publish state
7881
struct PublishState {
79-
bool nodeExists{false};
80-
std::shared_ptr<moxygen::MoQSession> session{nullptr};
82+
bool nodeExists{false}; // true if tree node exists
83+
std::shared_ptr<moxygen::MoQSession> session{nullptr}; // publish session if exists
8184
};
8285
PublishState findPublishState(const moxygen::FullTrackName& ftn);
8386

@@ -123,9 +126,20 @@ class ORelay : public moxygen::Publisher,
123126

124127
// Maps a track name to a the session performing the PUBLISH
125128
folly::F14FastMap<std::string, std::shared_ptr<moxygen::MoQSession>> publishes;
126-
// Sessions with a SUBSCRIBE_NAMESPACE here, with their forward preference
127-
// Key: session, Value: forward (true = forward data, false = don't forward)
128-
folly::F14FastMap<std::shared_ptr<moxygen::MoQSession>, bool> sessions;
129+
130+
// Info stored per SUBSCRIBE_NAMESPACE subscriber
131+
struct NamespaceSubscriberInfo {
132+
bool forward{true};
133+
moxygen::SubscribeNamespaceOptions options{moxygen::SubscribeNamespaceOptions::BOTH};
134+
// Handle for sending NAMESPACE / NAMESPACE_DONE on the bidi stream
135+
// (draft 16+). Null for draft <= 15.
136+
std::shared_ptr<moxygen::Publisher::NamespacePublishHandle> namespacePublishHandle;
137+
// The namespace prefix this subscriber used for SUBSCRIBE_NAMESPACE
138+
moxygen::TrackNamespace trackNamespacePrefix;
139+
};
140+
141+
// Sessions with a SUBSCRIBE_NAMESPACE here, with their preferences
142+
folly::F14FastMap<std::shared_ptr<moxygen::MoQSession>, NamespaceSubscriberInfo> sessions;
129143
// All active PUBLISH_NAMESPACEs for this node (includes prefix sessions)
130144
folly::F14FastMap<std::shared_ptr<moxygen::MoQSession>, std::shared_ptr<PublishNamespaceHandle>>
131145
namespacesPublished;
@@ -152,7 +166,9 @@ class ORelay : public moxygen::Publisher,
152166
const moxygen::TrackNamespace& ns,
153167
bool createMissingNodes = false,
154168
MatchType matchType = MatchType::Exact,
155-
std::vector<std::pair<std::shared_ptr<moxygen::MoQSession>, bool>>* sessions = nullptr
169+
std::vector<
170+
std::pair<std::shared_ptr<moxygen::MoQSession>, NamespaceNode::NamespaceSubscriberInfo>>*
171+
sessions = nullptr
156172
);
157173

158174
struct RelaySubscription {
@@ -182,7 +198,6 @@ class ORelay : public moxygen::Publisher,
182198
folly::coro::Task<void> publishToSession(
183199
std::shared_ptr<moxygen::MoQSession> session,
184200
std::shared_ptr<moxygen::MoQForwarder> forwarder,
185-
moxygen::PublishRequest pub,
186201
bool forward
187202
);
188203

0 commit comments

Comments
 (0)