2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-09-02 07:25:46 +00:00

Improve working with sessions.

This commit is contained in:
John Preston
2019-11-14 20:39:15 +03:00
parent 1e252a6505
commit fe1e627cac
3 changed files with 139 additions and 116 deletions

View File

@@ -143,12 +143,11 @@ void SessionData::clear(Instance *instance) {
Session::Session(not_null<Instance*> instance, ShiftedDcId shiftedDcId)
: QObject()
, _instance(instance)
, _data(this)
, _shiftedDcId(shiftedDcId)
, _data(this)
, _timeouter([=] { checkRequestsByTimer(); })
, _sender([=] { needToResumeAndSend(); }) {
connect(&_timeouter, SIGNAL(timeout()), this, SLOT(checkRequestsByTimer()));
_timeouter.start(1000);
_timeouter.callEach(1000);
refreshOptions();
}
@@ -291,9 +290,7 @@ void Session::needToResumeAndSend() {
}
if (!_connection) {
DEBUG_LOG(("Session Info: resuming session dcWithShift %1").arg(_shiftedDcId));
createDcData();
_connection = std::make_unique<Connection>(_instance);
_connection->start(&_data, _shiftedDcId);
start();
}
if (_ping) {
_ping = false;