Preserve initial channel watches until desktop core attaches
This commit is contained in:
1 parent
17606c66b8
commit
061eb0f0f8
3 files changed
+13
-3
No files matched your search
@@ -1479,7 +1479,7 @@ void MessageList::onRadioTalk(quint64 groupId, quint64 srcNodeId, bool on) {
|
|||||||
|
|
||||||
/* Каталог выбранного канала не удерживает media owner; DM/пустой target снимает наблюдение. */
|
/* Каталог выбранного канала не удерживает media owner; DM/пустой target снимает наблюдение. */
|
||||||
void MessageList::watchStreams() {
|
void MessageList::watchStreams() {
|
||||||
if (gui_stream_ready()) gui_stream_watch(isDmChannel(m_currentChannelId) ? 0 : m_currentChannelId.toULongLong());
|
gui_stream_watch(isDmChannel(m_currentChannelId) ? 0 : m_currentChannelId.toULongLong());
|
||||||
}
|
}
|
||||||
|
|
||||||
void MessageList::clearStreams() { m_streamSources.clear(); m_streamBtn->hide(); }
|
void MessageList::clearStreams() { m_streamSources.clear(); m_streamBtn->hide(); }
|
||||||
|
|||||||
@@ -98,7 +98,8 @@ private slots:
|
|||||||
QCOMPARE(sqlite3_step(statement), SQLITE_ROW);
|
QCOMPARE(sqlite3_step(statement), SQLITE_ROW);
|
||||||
group = QString::fromUtf8(reinterpret_cast<const char*>(sqlite3_column_text(statement, 0))).toULongLong();
|
group = QString::fromUtf8(reinterpret_cast<const char*>(sqlite3_column_text(statement, 0))).toULongLong();
|
||||||
sqlite3_finalize(statement); QVERIFY(group);
|
sqlite3_finalize(statement); QVERIFY(group);
|
||||||
chat_event_set_handler(inst, sourceEvent); QVERIFY(gui_stream_attach(inst)); uasync_mark_running(ua);
|
chat_event_set_handler(inst, sourceEvent); QVERIFY(gui_stream_watch(group));
|
||||||
|
QVERIFY(gui_stream_attach(inst)); uasync_mark_running(ua);
|
||||||
connect(&poll, &QTimer::timeout, this, [this] { uasync_poll(ua, 0); }); poll.start(1);
|
connect(&poll, &QTimer::timeout, this, [this] { uasync_poll(ua, 0); }); poll.start(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ void process(void*);
|
|||||||
|
|
||||||
/* Вызывается под lock; резервирование делает отказ команды наблюдаемым до изменения состояния. */
|
/* Вызывается под lock; резервирование делает отказ команды наблюдаемым до изменения состояния. */
|
||||||
bool schedule() {
|
bool schedule() {
|
||||||
if (!bridge.inst || !uasync_is_running(bridge.inst->ua)) {
|
if (!bridge.inst) {
|
||||||
DEBUG_WARN(DEBUG_CATEGORY_STREAM, "desktop stream command rejected: core unavailable"); return false;
|
DEBUG_WARN(DEBUG_CATEGORY_STREAM, "desktop stream command rejected: core unavailable"); return false;
|
||||||
}
|
}
|
||||||
if (bridge.pending) return true;
|
if (bridge.pending) return true;
|
||||||
@@ -150,6 +150,11 @@ bool gui_stream_attach(UTUN_INSTANCE* inst) {
|
|||||||
}
|
}
|
||||||
bridge.inst = inst; bridge.output.clear(); bridge.bytes = 0;
|
bridge.inst = inst; bridge.output.clear(); bridge.bytes = 0;
|
||||||
stream_set_event_callback(inst, mediaEvent, nullptr);
|
stream_set_event_callback(inst, mediaEvent, nullptr);
|
||||||
|
if (bridge.watchPending) {
|
||||||
|
bridge.watchPending = false;
|
||||||
|
if (stream_watch_sources(inst, bridge.watch) != STREAM_OK)
|
||||||
|
DEBUG_ERROR(DEBUG_CATEGORY_STREAM, "desktop initial source watch failed group=%llx", (unsigned long long)bridge.watch);
|
||||||
|
}
|
||||||
DEBUG_INFO(DEBUG_CATEGORY_STREAM, "desktop stream bridge attached"); return true;
|
DEBUG_INFO(DEBUG_CATEGORY_STREAM, "desktop stream bridge attached"); return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -167,6 +172,10 @@ void gui_stream_detach(UTUN_INSTANCE* inst) {
|
|||||||
|
|
||||||
bool gui_stream_watch(uint64_t group) {
|
bool gui_stream_watch(uint64_t group) {
|
||||||
std::lock_guard<std::mutex> guard(bridge.lock);
|
std::lock_guard<std::mutex> guard(bridge.lock);
|
||||||
|
if (!bridge.inst) {
|
||||||
|
bridge.watch = group; bridge.watchPending = true;
|
||||||
|
DEBUG_DEBUG(DEBUG_CATEGORY_STREAM, "desktop source watch queued until attach group=%llx", (unsigned long long)group); return true;
|
||||||
|
}
|
||||||
if (!schedule()) return false;
|
if (!schedule()) return false;
|
||||||
bridge.watch = group; bridge.watchPending = true; return true;
|
bridge.watch = group; bridge.watchPending = true; return true;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user