Add more logging on failed top peers reading.

This commit is contained in:
John Preston 2024-10-24 16:37:31 +04:00
parent d6863074b2
commit 0397006894
2 changed files with 6 additions and 0 deletions

View file

@ -112,6 +112,7 @@ void RecentPeers::applyLocal(QByteArray serialized) {
).arg(streamAppVersion));
_list.reserve(count);
for (auto i = 0; i != int(count); ++i) {
const auto streamPosition = stream.underlying().device()->pos();
const auto peer = Serialize::readPeer(
_session,
streamAppVersion,
@ -123,6 +124,8 @@ void RecentPeers::applyLocal(QByteArray serialized) {
DEBUG_LOG(("Suggestions: Failed RecentPeers reading %1 / %2."
).arg(i + 1
).arg(count));
DEBUG_LOG(("Failed bytes: %1.").arg(
QString::fromUtf8(serialized.mid(streamPosition).toHex())));
_list.clear();
return;
}

View file

@ -300,6 +300,7 @@ void TopPeers::applyLocal(QByteArray serialized) {
_list.reserve(count);
for (auto i = 0; i != int(count); ++i) {
auto rating = quint64();
const auto streamPosition = stream.underlying().device()->pos();
const auto peer = Serialize::readPeer(
_session,
streamAppVersion,
@ -313,6 +314,8 @@ void TopPeers::applyLocal(QByteArray serialized) {
} else {
DEBUG_LOG(("Suggestions: "
"Failed TopPeers reading %1 / %2.").arg(i + 1).arg(count));
DEBUG_LOG(("Failed bytes: %1.").arg(
QString::fromUtf8(serialized.mid(streamPosition).toHex())));
_list.clear();
return;
}