mirror of https://github.com/procxx/kepka.git
critical bug fixed in auth import, 0.9.35 dev version
This commit is contained in:
parent
a69a5c7252
commit
40ab82e4bd
|
@ -452,7 +452,7 @@ ConnectionPrivate::ConnectionPrivate(QThread *thread, Connection *owner, Session
|
||||||
|
|
||||||
connect(thread, SIGNAL(started()), this, SLOT(socketStart()));
|
connect(thread, SIGNAL(started()), this, SLOT(socketStart()));
|
||||||
connect(thread, SIGNAL(finished()), this, SLOT(doFinish()));
|
connect(thread, SIGNAL(finished()), this, SLOT(doFinish()));
|
||||||
connect(this, SIGNAL(finished(MTProtoConnection*)), globalSlotCarrier(), SLOT(connectionFinished(MTProtoConnection*)), Qt::QueuedConnection);
|
connect(this, SIGNAL(finished(Connection*)), globalSlotCarrier(), SLOT(connectionFinished(Connection*)), Qt::QueuedConnection);
|
||||||
|
|
||||||
connect(&retryTimer, SIGNAL(timeout()), this, SLOT(retryByTimer()));
|
connect(&retryTimer, SIGNAL(timeout()), this, SLOT(retryByTimer()));
|
||||||
connect(&_waitForConnectedTimer, SIGNAL(timeout()), this, SLOT(onWaitConnectedFailed()));
|
connect(&_waitForConnectedTimer, SIGNAL(timeout()), this, SLOT(onWaitConnectedFailed()));
|
||||||
|
@ -765,13 +765,13 @@ void ConnectionPrivate::tryToSend() {
|
||||||
if (_pingIdToSend) {
|
if (_pingIdToSend) {
|
||||||
if (prependOnly || dc != bareDcId(dc)) {
|
if (prependOnly || dc != bareDcId(dc)) {
|
||||||
MTPPing ping(MTPping(MTP_long(_pingIdToSend)));
|
MTPPing ping(MTPping(MTP_long(_pingIdToSend)));
|
||||||
uint32 pingSize = ping.innerLength() >> 2; // copy from MTProtoSession::send
|
uint32 pingSize = ping.innerLength() >> 2; // copy from Session::send
|
||||||
pingRequest = mtpRequestData::prepare(pingSize);
|
pingRequest = mtpRequestData::prepare(pingSize);
|
||||||
ping.write(*pingRequest);
|
ping.write(*pingRequest);
|
||||||
DEBUG_LOG(("MTP Info: sending ping, ping_id: %1").arg(_pingIdToSend));
|
DEBUG_LOG(("MTP Info: sending ping, ping_id: %1").arg(_pingIdToSend));
|
||||||
} else {
|
} else {
|
||||||
MTPPing_delay_disconnect ping(MTP_long(_pingIdToSend), MTP_int(MTPPingDelayDisconnect));
|
MTPPing_delay_disconnect ping(MTP_long(_pingIdToSend), MTP_int(MTPPingDelayDisconnect));
|
||||||
uint32 pingSize = ping.innerLength() >> 2; // copy from MTProtoSession::send
|
uint32 pingSize = ping.innerLength() >> 2; // copy from Session::send
|
||||||
pingRequest = mtpRequestData::prepare(pingSize);
|
pingRequest = mtpRequestData::prepare(pingSize);
|
||||||
ping.write(*pingRequest);
|
ping.write(*pingRequest);
|
||||||
DEBUG_LOG(("MTP Info: sending ping_delay_disconnect, ping_id: %1").arg(_pingIdToSend));
|
DEBUG_LOG(("MTP Info: sending ping_delay_disconnect, ping_id: %1").arg(_pingIdToSend));
|
||||||
|
@ -1176,7 +1176,7 @@ void ConnectionPrivate::restart(bool mayBeBadKey) {
|
||||||
QReadLocker lockFinished(&sessionDataMutex);
|
QReadLocker lockFinished(&sessionDataMutex);
|
||||||
if (!sessionData) return;
|
if (!sessionData) return;
|
||||||
|
|
||||||
DEBUG_LOG(("MTP Info: restarting MTProtoConnection, maybe bad key = %1").arg(Logs::b(mayBeBadKey)));
|
DEBUG_LOG(("MTP Info: restarting Connection, maybe bad key = %1").arg(Logs::b(mayBeBadKey)));
|
||||||
|
|
||||||
_waitForReceivedTimer.stop();
|
_waitForReceivedTimer.stop();
|
||||||
_waitForConnectedTimer.stop();
|
_waitForConnectedTimer.stop();
|
||||||
|
@ -2342,7 +2342,7 @@ void ConnectionPrivate::updateAuthKey() {
|
||||||
QReadLocker lockFinished(&sessionDataMutex);
|
QReadLocker lockFinished(&sessionDataMutex);
|
||||||
if (!sessionData || !_conn) return;
|
if (!sessionData || !_conn) return;
|
||||||
|
|
||||||
DEBUG_LOG(("AuthKey Info: MTProtoConnection updating key from MTProtoSession, dc %1").arg(dc));
|
DEBUG_LOG(("AuthKey Info: Connection updating key from Session, dc %1").arg(dc));
|
||||||
uint64 newKeyId = 0;
|
uint64 newKeyId = 0;
|
||||||
{
|
{
|
||||||
ReadLockerAttempt lock(sessionData->keyMutex());
|
ReadLockerAttempt lock(sessionData->keyMutex());
|
||||||
|
@ -2359,7 +2359,7 @@ void ConnectionPrivate::updateAuthKey() {
|
||||||
clearMessages();
|
clearMessages();
|
||||||
keyId = newKeyId;
|
keyId = newKeyId;
|
||||||
}
|
}
|
||||||
DEBUG_LOG(("AuthKey Info: MTProtoConnection update key from MTProtoSession, dc %1 result: %2").arg(dc).arg(Logs::mb(&keyId, sizeof(keyId)).str()));
|
DEBUG_LOG(("AuthKey Info: Connection update key from Session, dc %1 result: %2").arg(dc).arg(Logs::mb(&keyId, sizeof(keyId)).str()));
|
||||||
if (keyId) {
|
if (keyId) {
|
||||||
return authKeyCreated();
|
return authKeyCreated();
|
||||||
}
|
}
|
||||||
|
|
|
@ -100,7 +100,7 @@ namespace {
|
||||||
LOG(("MTP Error: could not find request %1 for resending").arg(requestId));
|
LOG(("MTP Error: could not find request %1 for resending").arg(requestId));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
int32 dcWithShift = newdc;
|
ShiftedDcId dcWithShift = newdc;
|
||||||
{
|
{
|
||||||
RequestsByDC::iterator k = requestsByDC.find(requestId);
|
RequestsByDC::iterator k = requestsByDC.find(requestId);
|
||||||
if (k == requestsByDC.cend()) {
|
if (k == requestsByDC.cend()) {
|
||||||
|
@ -111,7 +111,7 @@ namespace {
|
||||||
setdc(newdc);
|
setdc(newdc);
|
||||||
k.value() = -newdc;
|
k.value() = -newdc;
|
||||||
} else {
|
} else {
|
||||||
dcWithShift += getDcIdShift(k.value());
|
dcWithShift = shiftDcId(newdc, getDcIdShift(k.value()));
|
||||||
k.value() = dcWithShift;
|
k.value() = dcWithShift;
|
||||||
}
|
}
|
||||||
DEBUG_LOG(("MTP Info: resending request %1 to dc %2 after import auth").arg(requestId).arg(k.value()));
|
DEBUG_LOG(("MTP Info: resending request %1 to dc %2 after import auth").arg(requestId).arg(k.value()));
|
||||||
|
@ -167,7 +167,7 @@ namespace {
|
||||||
if ((m = QRegularExpression("^(FILE|PHONE|NETWORK|USER)_MIGRATE_(\\d+)$").match(err)).hasMatch()) {
|
if ((m = QRegularExpression("^(FILE|PHONE|NETWORK|USER)_MIGRATE_(\\d+)$").match(err)).hasMatch()) {
|
||||||
if (!requestId) return false;
|
if (!requestId) return false;
|
||||||
|
|
||||||
int32 dcWithShift = 0, newdcWithShift = m.captured(2).toInt();
|
ShiftedDcId dcWithShift = 0, newdcWithShift = m.captured(2).toInt();
|
||||||
{
|
{
|
||||||
QMutexLocker locker(&requestByDCLock);
|
QMutexLocker locker(&requestByDCLock);
|
||||||
RequestsByDC::iterator i = requestsByDC.find(requestId);
|
RequestsByDC::iterator i = requestsByDC.find(requestId);
|
||||||
|
@ -193,7 +193,7 @@ namespace {
|
||||||
MTP::setdc(newdcWithShift);
|
MTP::setdc(newdcWithShift);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
newdcWithShift += MTP::getDcIdShift(dcWithShift);
|
newdcWithShift = shiftDcId(newdcWithShift, getDcIdShift(dcWithShift));
|
||||||
}
|
}
|
||||||
|
|
||||||
mtpRequest req;
|
mtpRequest req;
|
||||||
|
|
|
@ -85,7 +85,7 @@ Session::Session(int32 dcenter) : QObject()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (dcWithShift) {
|
if (dcWithShift) {
|
||||||
DEBUG_LOG(("Session Info: MTProtoSession::start called on already started session"));
|
DEBUG_LOG(("Session Info: Session::start called on already started session"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -461,18 +461,18 @@ QReadWriteLock *Session::keyMutex() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Session::authKeyCreatedForDC() {
|
void Session::authKeyCreatedForDC() {
|
||||||
DEBUG_LOG(("AuthKey Info: MTProtoSession::authKeyCreatedForDC slot, emitting authKeyCreated(), dcWithShift %1").arg(dcWithShift));
|
DEBUG_LOG(("AuthKey Info: Session::authKeyCreatedForDC slot, emitting authKeyCreated(), dcWithShift %1").arg(dcWithShift));
|
||||||
data.setKey(dc->getKey());
|
data.setKey(dc->getKey());
|
||||||
emit authKeyCreated();
|
emit authKeyCreated();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Session::notifyKeyCreated(const AuthKeyPtr &key) {
|
void Session::notifyKeyCreated(const AuthKeyPtr &key) {
|
||||||
DEBUG_LOG(("AuthKey Info: MTProtoSession::keyCreated(), setting, dcWithShift %1").arg(dcWithShift));
|
DEBUG_LOG(("AuthKey Info: Session::keyCreated(), setting, dcWithShift %1").arg(dcWithShift));
|
||||||
dc->setKey(key);
|
dc->setKey(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Session::layerWasInitedForDC(bool wasInited) {
|
void Session::layerWasInitedForDC(bool wasInited) {
|
||||||
DEBUG_LOG(("MTP Info: MTProtoSession::layerWasInitedForDC slot, dcWithShift %1").arg(dcWithShift));
|
DEBUG_LOG(("MTP Info: Session::layerWasInitedForDC slot, dcWithShift %1").arg(dcWithShift));
|
||||||
data.setLayerWasInited(wasInited);
|
data.setLayerWasInited(wasInited);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue