mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Always resend messages in a container.
This commit is contained in:
parent
8fc7ba7ac1
commit
bae8335285
2 changed files with 8 additions and 14 deletions
|
@ -298,7 +298,7 @@ void SessionPrivate::clearOldContainers() {
|
||||||
|
|
||||||
resent = resent || !ids.empty();
|
resent = resent || !ids.empty();
|
||||||
for (const auto innerMsgId : ids) {
|
for (const auto innerMsgId : ids) {
|
||||||
resend(innerMsgId, -1, true);
|
resend(innerMsgId, -1);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
nextTimeout = std::min(i->second.sent - checkTime, nextTimeout);
|
nextTimeout = std::min(i->second.sent - checkTime, nextTimeout);
|
||||||
|
@ -1555,7 +1555,7 @@ SessionPrivate::HandleResult SessionPrivate::handleOneReceived(
|
||||||
|
|
||||||
DEBUG_LOG(("Message Info: unixtime updated, now %1, resending in container...").arg(info.serverTime));
|
DEBUG_LOG(("Message Info: unixtime updated, now %1, resending in container...").arg(info.serverTime));
|
||||||
|
|
||||||
resend(resendId, 0, true);
|
resend(resendId);
|
||||||
} else { // must create new session, because msg_id and msg_seqno are inconsistent
|
} else { // must create new session, because msg_id and msg_seqno are inconsistent
|
||||||
if (info.badTime) {
|
if (info.badTime) {
|
||||||
if (info.serverSalt) {
|
if (info.serverSalt) {
|
||||||
|
@ -1853,7 +1853,7 @@ SessionPrivate::HandleResult SessionPrivate::handleOneReceived(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (const auto msgId : toResend) {
|
for (const auto msgId : toResend) {
|
||||||
resend(msgId, 10, true);
|
resend(msgId, 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
mtpBuffer update(from - start);
|
mtpBuffer update(from - start);
|
||||||
|
@ -2165,7 +2165,7 @@ void SessionPrivate::handleMsgsStates(const QVector<MTPlong> &ids, const QByteAr
|
||||||
}
|
}
|
||||||
if ((state & 0x07) != 0x04) { // was received
|
if ((state & 0x07) != 0x04) { // was received
|
||||||
DEBUG_LOG(("Message Info: state was received for msgId %1, state %2, resending in container").arg(requestMsgId).arg((int32)state));
|
DEBUG_LOG(("Message Info: state was received for msgId %1, state %2, resending in container").arg(requestMsgId).arg((int32)state));
|
||||||
resend(requestMsgId, 10, true);
|
resend(requestMsgId, 10);
|
||||||
} else {
|
} else {
|
||||||
DEBUG_LOG(("Message Info: state was received for msgId %1, state %2, ack").arg(requestMsgId).arg((int32)state));
|
DEBUG_LOG(("Message Info: state was received for msgId %1, state %2, ack").arg(requestMsgId).arg((int32)state));
|
||||||
acked.push_back(MTP_long(requestMsgId));
|
acked.push_back(MTP_long(requestMsgId));
|
||||||
|
@ -2183,10 +2183,7 @@ void SessionPrivate::clearSpecialMsgId(mtpMsgId msgId) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SessionPrivate::resend(
|
void SessionPrivate::resend(mtpMsgId msgId, crl::time msCanWait) {
|
||||||
mtpMsgId msgId,
|
|
||||||
crl::time msCanWait,
|
|
||||||
bool forceContainer) {
|
|
||||||
const auto guard = gsl::finally([&] {
|
const auto guard = gsl::finally([&] {
|
||||||
clearSpecialMsgId(msgId);
|
clearSpecialMsgId(msgId);
|
||||||
if (msCanWait >= 0) {
|
if (msCanWait >= 0) {
|
||||||
|
@ -2200,7 +2197,7 @@ void SessionPrivate::resend(
|
||||||
_sentContainers.erase(i);
|
_sentContainers.erase(i);
|
||||||
|
|
||||||
for (const auto innerMsgId : ids) {
|
for (const auto innerMsgId : ids) {
|
||||||
resend(innerMsgId, -1, true);
|
resend(innerMsgId, -1);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -2215,7 +2212,7 @@ void SessionPrivate::resend(
|
||||||
lock.unlock();
|
lock.unlock();
|
||||||
|
|
||||||
request->lastSentTime = crl::now();
|
request->lastSentTime = crl::now();
|
||||||
request->forceSendInContainer = forceContainer;
|
request->forceSendInContainer = true;
|
||||||
_resendingIds.emplace(msgId, request->requestId);
|
_resendingIds.emplace(msgId, request->requestId);
|
||||||
{
|
{
|
||||||
QWriteLocker locker(_sessionData->toSendMutex());
|
QWriteLocker locker(_sessionData->toSendMutex());
|
||||||
|
|
|
@ -158,10 +158,7 @@ private:
|
||||||
// remove msgs with such ids from sessionData->haveSent, add to sessionData->wereAcked
|
// remove msgs with such ids from sessionData->haveSent, add to sessionData->wereAcked
|
||||||
void requestsAcked(const QVector<MTPlong> &ids, bool byResponse = false);
|
void requestsAcked(const QVector<MTPlong> &ids, bool byResponse = false);
|
||||||
|
|
||||||
void resend(
|
void resend(mtpMsgId msgId, crl::time msCanWait = 0);
|
||||||
mtpMsgId msgId,
|
|
||||||
crl::time msCanWait = 0,
|
|
||||||
bool forceContainer = false);
|
|
||||||
void resendAll();
|
void resendAll();
|
||||||
void clearSpecialMsgId(mtpMsgId msgId);
|
void clearSpecialMsgId(mtpMsgId msgId);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue