Fix connection re-init in case of CONNECTION_NOT_INITED.

This commit is contained in:
John Preston 2022-12-29 11:42:08 +04:00
parent 13ad39dfc2
commit cad6faa790
3 changed files with 7 additions and 1 deletions

View file

@ -1537,6 +1537,7 @@ bool Instance::Private::onErrorDefault(
const auto session = getSession(qAbs(dcWithShift)); const auto session = getSession(qAbs(dcWithShift));
request->needsLayer = true; request->needsLayer = true;
session->setConnectionNotInited();
session->sendPrepared(request); session->sendPrepared(request);
return true; return true;
} else if (type == u"CONNECTION_LANG_CODE_INVALID"_q) { } else if (type == u"CONNECTION_LANG_CODE_INVALID"_q) {

View file

@ -257,10 +257,14 @@ void Session::refreshOptions() {
} }
void Session::reInitConnection() { void Session::reInitConnection() {
_dc->setConnectionInited(false); setConnectionNotInited();
restart(); restart();
} }
void Session::setConnectionNotInited() {
_dc->setConnectionInited(false);
}
void Session::stop() { void Session::stop() {
if (_killed) { if (_killed) {
DEBUG_LOG(("Session Error: can't stop a killed session")); DEBUG_LOG(("Session Error: can't stop a killed session"));

View file

@ -142,6 +142,7 @@ public:
void start(); void start();
void reInitConnection(); void reInitConnection();
void setConnectionNotInited();
void restart(); void restart();
void refreshOptions(); void refreshOptions();