[MG_Remote, MG_Test] (P7): the server binds its deferred stream link through the Transport factory

This commit is contained in:
2026-09-23 13:23:09 -04:00
parent 14e1c8b9b1
commit eaef83b32a
5 changed files with 82 additions and 20 deletions
+10
View File
@@ -343,5 +343,15 @@ namespace MobileGL::MG_Remote::Transport {
std::unique_ptr<ILink> CreateSharedLink(TransportRoleTag role);
MobileGLResult CreateStreamLink(int fd, const SessionSegmentSizes& sizes,
TransportRoleTag role, std::unique_ptr<ILink>& out);
// PH-7 (4), ID-P7-3. The server's nonce-bound stream link, in the two steps
// StreamLink::AttachOwnedDeferred / BindDataFd describe: created with its owned memory and
// no descriptor (Welcome announces those sizes before the data connection exists), then
// bound to the one data connection that presented the session's nonce. Both halves live
// here so session code never names the concrete link (scripts/ci/link_seam_purity.py).
// Binding answers INVALID_ARGUMENT for a link these factories did not make as a stream,
// and leaves `fd` to the caller whenever it does not answer OK.
MobileGLResult CreateDeferredStreamLink(const SessionSegmentSizes& sizes, TransportRoleTag role,
std::unique_ptr<ILink>& out);
MobileGLResult BindStreamLinkDataFd(ILink& link, int fd);
} // namespace MobileGL::MG_Remote::Transport
@@ -399,6 +399,18 @@ namespace MobileGL::MG_Remote::Transport {
#endif
return result;
}
MobileGLResult CreateDeferredStreamLink(const SessionSegmentSizes& sizes, TransportRoleTag role,
std::unique_ptr<ILink>& out) {
auto link = std::make_unique<StreamLink>();
const auto result = link->AttachOwnedDeferred(sizes, role);
if (result == MOBILEGL_OK) out = std::move(link);
return result;
}
MobileGLResult BindStreamLinkDataFd(ILink& link, int fd) {
auto* stream = dynamic_cast<StreamLink*>(&link);
if (stream == nullptr) return MOBILEGL_ERR_INVALID_ARGUMENT;
return stream->BindDataFd(fd);
}
void StreamLink::InitializeEndpoints() {
m_impl->owned->SetRole(m_impl->role);
m_impl->owned->InitializeEndpoints();