mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 22:54:01 +02:00
Log applying blocks and fix sub_chain_id:1.
This commit is contained in:
parent
09229812f4
commit
6528567746
2 changed files with 33 additions and 1 deletions
|
@ -729,6 +729,11 @@ void GroupCall::setupConferenceCall() {
|
||||||
}
|
}
|
||||||
_conferenceCall->setParticipantsWithAccess(std::move(users));
|
_conferenceCall->setParticipantsWithAccess(std::move(users));
|
||||||
}, _lifetime);
|
}, _lifetime);
|
||||||
|
|
||||||
|
_e2e->failures() | rpl::start_with_next([=] {
|
||||||
|
LOG(("TdE2E: Got failure!"));
|
||||||
|
hangup();
|
||||||
|
}, _lifetime);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GroupCall::removeConferenceParticipants(
|
void GroupCall::removeConferenceParticipants(
|
||||||
|
|
|
@ -19,6 +19,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
LOG_ERROR(error); \
|
LOG_ERROR(error); \
|
||||||
fail(reason)
|
fail(reason)
|
||||||
|
|
||||||
|
#define LOG_APPLY(subchain, slice) \
|
||||||
|
DEBUG_LOG(("TdE2E Apply[%1]: %2").arg(subchain).arg(WrapForLog(slice)))
|
||||||
|
|
||||||
namespace TdE2E {
|
namespace TdE2E {
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
|
@ -52,6 +55,23 @@ constexpr auto kShortPollChainBlocksWaitFor = crl::time(1000);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[[nodiscard]] QString WrapForLog(std::string_view v) {
|
||||||
|
auto result = QString();
|
||||||
|
const auto count = std::min(int(v.size()), 16);
|
||||||
|
result.reserve(count * 3 + 2);
|
||||||
|
for (auto i = 0; i != count; ++i) {
|
||||||
|
const auto byte = uint8(v[i]);
|
||||||
|
result += QString::number(byte, 16).rightJustified(2, '0');
|
||||||
|
if (i + 1 != count) {
|
||||||
|
result += ' ';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (v.size() > count) {
|
||||||
|
result += "...";
|
||||||
|
}
|
||||||
|
return result.toUpper();
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
Call::Call(UserId myUserId)
|
Call::Call(UserId myUserId)
|
||||||
|
@ -195,6 +215,7 @@ void Call::apply(int subchain, const Block &last) {
|
||||||
});
|
});
|
||||||
|
|
||||||
if (subchain) {
|
if (subchain) {
|
||||||
|
LOG_APPLY(1, Slice(last.data));
|
||||||
auto result = tde2e_api::call_receive_inbound_message(
|
auto result = tde2e_api::call_receive_inbound_message(
|
||||||
libId(),
|
libId(),
|
||||||
Slice(last.data));
|
Slice(last.data));
|
||||||
|
@ -205,6 +226,7 @@ void Call::apply(int subchain, const Block &last) {
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
} else if (_id) {
|
} else if (_id) {
|
||||||
|
LOG_APPLY(0, Slice(last.data));
|
||||||
const auto result = tde2e_api::call_apply_block(
|
const auto result = tde2e_api::call_apply_block(
|
||||||
libId(),
|
libId(),
|
||||||
Slice(last.data));
|
Slice(last.data));
|
||||||
|
@ -215,6 +237,7 @@ void Call::apply(int subchain, const Block &last) {
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
LOG_APPLY(-1, Slice(last.data));
|
||||||
const auto id = tde2e_api::call_create(
|
const auto id = tde2e_api::call_create(
|
||||||
std::int64_t(_myKeyId.v),
|
std::int64_t(_myKeyId.v),
|
||||||
Slice(last.data));
|
Slice(last.data));
|
||||||
|
@ -296,7 +319,9 @@ void Call::apply(
|
||||||
|
|
||||||
if (failed()) {
|
if (failed()) {
|
||||||
return;
|
return;
|
||||||
} else if (!_id || entry.height == index) {
|
} else if (!_id
|
||||||
|
|| (subchain && !entry.height && fromShortPoll)
|
||||||
|
|| (entry.height == index)) {
|
||||||
apply(subchain, block);
|
apply(subchain, block);
|
||||||
}
|
}
|
||||||
entry.height = std::max(entry.height, index + 1);
|
entry.height = std::max(entry.height, index + 1);
|
||||||
|
@ -331,6 +356,7 @@ void Call::checkWaitingBlocks(int subchain, bool waited) {
|
||||||
} else if (index == entry.height) {
|
} else if (index == entry.height) {
|
||||||
const auto slice = Slice(waiting.begin()->second.data);
|
const auto slice = Slice(waiting.begin()->second.data);
|
||||||
if (subchain) {
|
if (subchain) {
|
||||||
|
LOG_APPLY(1, slice);
|
||||||
auto result = tde2e_api::call_receive_inbound_message(
|
auto result = tde2e_api::call_receive_inbound_message(
|
||||||
libId(),
|
libId(),
|
||||||
slice);
|
slice);
|
||||||
|
@ -343,6 +369,7 @@ void Call::checkWaitingBlocks(int subchain, bool waited) {
|
||||||
: QByteArray();
|
: QByteArray();
|
||||||
checkForOutboundMessages();
|
checkForOutboundMessages();
|
||||||
} else {
|
} else {
|
||||||
|
LOG_APPLY(0, slice);
|
||||||
const auto result = tde2e_api::call_apply_block(
|
const auto result = tde2e_api::call_apply_block(
|
||||||
libId(),
|
libId(),
|
||||||
slice);
|
slice);
|
||||||
|
|
Loading…
Add table
Reference in a new issue