Mark connection as inited only on a non-error response.

This commit is contained in:
John Preston 2017-05-17 14:01:58 +03:00
parent b88a49d2f8
commit 52f7c8f064
1 changed files with 8 additions and 3 deletions

View File

@ -1848,10 +1848,15 @@ ConnectionPrivate::HandleResult ConnectionPrivate::handleOneReceived(const mtpPr
response.resize(end - from);
memcpy(response.data(), from, (end - from) * sizeof(mtpPrime));
}
if (typeId != mtpc_rpc_error) {
// An error could be some RPC_CALL_FAIL or other error inside
// the initConnection, so we're not sure yet that it was inited.
// Wait till a good response is received.
if (!sessionData->layerWasInited()) {
sessionData->setLayerWasInited(true);
sessionData->owner()->notifyLayerInited(true);
}
}
auto requestId = wasSent(reqMsgId.v);
if (requestId && requestId != mtpRequestId(0xFFFFFFFF)) {