Skip to content

Commit 0560f78

Browse files
authored
[0.77] Enforce SendPendingMessages in dispatch queue (#14503)
* Enforce SendPendingMessages in dispatch queue (#14487) * Make ExperimentalFeatures overridable * Enforce SendPendingMessages in dispatch queue * Add WinUI 3 MSO UT packages lock file * Change files * Return if actual write fails * Remove unrelated lock file * Revert ExperimentalFeatures.props * Remove change file * Change files
1 parent 9613892 commit 0560f78

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"type": "patch",
3+
"comment": "Enforce SendPendingMessages in dispatch queue (#14487)",
4+
"packageName": "react-native-windows",
5+
"email": "[email protected]",
6+
"dependentChangeType": "patch"
7+
}

vnext/Shared/Networking/WinRTWebSocketResource.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,10 @@ fire_and_forget WinRTWebSocketResource2::PerformWrite(string &&message, bool isB
290290
}
291291

292292
IAsyncAction WinRTWebSocketResource2::SendPendingMessages() noexcept {
293+
// Enforcing execution in the background queue.
294+
// Awaiting of this coroutine will schedule its execution in the thread pool, ignoring the intended dispatch queue.
295+
co_await resume_in_queue(m_backgroundQueue);
296+
293297
auto self = shared_from_this();
294298

295299
while (!self->m_outgoingMessages.empty()) {
@@ -334,6 +338,7 @@ IAsyncAction WinRTWebSocketResource2::SendPendingMessages() noexcept {
334338
auto result = async.ErrorCode();
335339
if (result < 0) {
336340
Fail(std::move(result), ErrorType::Send);
341+
co_return;
337342
}
338343
}
339344
}

0 commit comments

Comments
 (0)