예제 #1
0
void Session::workBadMsgNotification(InboundPkt &inboundPkt, qint64 msgId) {
    mAsserter.check(inboundPkt.fetchInt() == (qint32)TL_BadMsgNotification);
    qint64 badMsgId = inboundPkt.fetchLong();
    qint32 badMsgSeqNo = inboundPkt.fetchInt();
    qint32 errorCode = inboundPkt.fetchInt();
    qCWarning(TG_CORE_SESSION) << "workBadMsgNotification: badMsgId =" << QString::number(badMsgId, 16) <<
            ", badMsgSeqNo =" << badMsgSeqNo << ", errorCode =" << errorCode;
    switch (errorCode) {
    case 16:
    case 17:
    case 19:
    case 32:
    case 33:
    case 64:
        // update time sync difference and reset msgIds counter
        qint32 serverTime = msgId >> 32LL;
        mTimeDifference = QDateTime::currentDateTime().toTime_t() - serverTime;

        qint64 nextId = generatePlainNextMsgId();
        if (!m_pendingQueries.contains(nextId)) {
            m_clientLastMsgId = 0;
        }

        // read removing from pending queries, recompose and send the last query
        Query *q = m_pendingQueries.take(badMsgId);
        qint64 newMsgId = recomposeAndSendQuery(q);
        if (newMsgId != 0) {
            Q_EMIT updateMessageId(badMsgId, newMsgId);
        }
        break;
    }
}
예제 #2
0
void Session::workBadServerSalt(InboundPkt &inboundPkt, qint64 msgId) {
    Q_UNUSED(msgId)
    mAsserter.check(inboundPkt.fetchInt() == (qint32)TL_BadServerSalt);
    qint64 badMsgId = inboundPkt.fetchLong();
    qint32 badMsgSeqNo = inboundPkt.fetchInt();
    qint32 errorCode = inboundPkt.fetchInt();
    qCDebug(TG_CORE_SESSION) << "workBadServerSalt: badMsgId =" << QString::number(badMsgId, 16)
            << ", badMsgSeqNo =" << badMsgSeqNo << ", errorCode =" << errorCode;
    m_dc->setServerSalt(inboundPkt.fetchLong()); // new server_salt
    Query *q = m_pendingQueries.take(badMsgId);
    qint64 newMsgId = recomposeAndSendQuery(q);
    if (newMsgId != 0) {
        Q_EMIT updateMessageId(badMsgId, newMsgId);
    }
}
void Session::workBadMsgNotification(InboundPkt &inboundPkt, qint64 msgId) {
    mAsserter.check(inboundPkt.fetchInt() == (qint32)TL_BadMsgNotification);
    qint64 badMsgId = inboundPkt.fetchLong();
    qint32 badMsgSeqNo = inboundPkt.fetchInt();
    qint32 errorCode = inboundPkt.fetchInt();
    qCWarning(TG_CORE_SESSION) << "workBadMsgNotification: msgId =" << badMsgId <<
                  ", seqNo =" << badMsgSeqNo << ", errorCode =" << errorCode;
    switch (errorCode) {
    case 16:
    case 17:
        // update time sync difference and reset msgIds counter
        qint32 serverTime = msgId >> 32LL;
        mTimeDifference = QDateTime::currentDateTime().toTime_t() - serverTime;
        m_clientLastMsgId = 0;
        // read removing from pending queries, recompose and send the last query
        Query *q = m_pendingQueries.take(badMsgId);
        recomposeAndSendQuery(q);
        break;
    }
}