Refresh WinRT subscriptions before the first incoming value

This commit is contained in:
evgeny committed 2026-10-29 22:21:51 +01:00
1 parent fabf0c1663
commit 358c3093dd
1 file changed
+9
+9
View File
@@ -329,6 +329,15 @@ struct WinState : std::enable_shared_from_this<WinState> {
}
auto* l = s.incoming(session);
if (!l) { if (response) request.RespondWithProtocolError(0x08); return; }
if (!l->opened) {
/* WriteRequested может обогнать posted SubscribedClientsChanged: перечитать реальные CCC. */
auto id = l->id; s.subscriptions(); l = s.link(id);
if (!l || !l->opened) {
DEBUG_WARN(CAT, "BLE WinRT write before mandatory subscriptions link=%llu", (unsigned long long)id);
if (response) request.RespondWithProtocolError(0x08);
return;
}
}
auto id = l->id; auto data = bytes(request.Value());
DEBUG_TRACE(CAT, "BLE WinRT RX write link=%llu bytes=%zu", (unsigned long long)id, data.size());
ble_backend_received(s.owner, id, channel, data.data(), data.size());