Skip to content

Commit e7fad1b

Browse files
afrindfacebook-github-bot
authored andcommitted
Change WebTransport write API to be always synchronous
Summary: Returning a SemiFuture when the stream window was full, and only allowing one was too heavy handed. Instead, just return the state and add a new API (awaitWritable) for applications that don't want to build a buffer. Reviewed By: sharmafb Differential Revision: D66881576 fbshipit-source-id: 38a88929c449df77eac7eb62af65085a4596710b
1 parent 173a601 commit e7fad1b

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

moxygen/MoQSession.cpp

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -135,9 +135,16 @@ folly::coro::Task<void> MoQSession::controlWriteLoop(
135135
co_await folly::coro::co_safe_point;
136136
auto writeRes =
137137
controlStream->writeStreamData(controlWriteBuf_.move(), false);
138-
if (writeRes) {
139-
co_await std::move(writeRes.value()).via(evb_);
138+
if (!writeRes) {
139+
XLOG(ERR) << "Write error: " << uint64_t(writeRes.error());
140+
break;
140141
}
142+
auto awaitRes = controlStream->awaitWritable();
143+
if (!awaitRes) {
144+
XLOG(ERR) << "Control stream write error";
145+
break;
146+
}
147+
co_await std::move(*awaitRes);
141148
}
142149
}
143150

@@ -1341,7 +1348,7 @@ folly::SemiFuture<folly::Unit> MoQSession::publishImpl(
13411348
}
13421349
}
13431350
}
1344-
return std::move(writeRes.value());
1351+
return folly::makeSemiFuture();
13451352
}
13461353
}
13471354

0 commit comments

Comments
 (0)