mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-09-04 00:15:42 +00:00
Send different dns requests for simple config.
This commit is contained in:
@@ -21,13 +21,31 @@ public:
|
||||
bytes::const_span secret)> callback,
|
||||
const QString &phone);
|
||||
|
||||
~SpecialConfigRequest();
|
||||
|
||||
private:
|
||||
void performAppRequest();
|
||||
void performDnsRequest();
|
||||
void appFinished();
|
||||
void dnsFinished();
|
||||
enum class Type {
|
||||
App,
|
||||
Dns,
|
||||
};
|
||||
struct Attempt {
|
||||
Type type;
|
||||
QString domain;
|
||||
};
|
||||
struct Request {
|
||||
Request(not_null<QNetworkReply*> reply);
|
||||
Request(Request &&other);
|
||||
Request &operator=(Request &&other);
|
||||
~Request();
|
||||
|
||||
void destroy();
|
||||
|
||||
QPointer<QNetworkReply> reply;
|
||||
|
||||
};
|
||||
|
||||
void sendNextRequest();
|
||||
void performRequest(const Attempt &attempt);
|
||||
void requestFinished(Type type, not_null<QNetworkReply*> reply);
|
||||
QByteArray finalizeRequest(not_null<QNetworkReply*> reply);
|
||||
void handleResponse(const QByteArray &bytes);
|
||||
bool decryptSimpleConfig(const QByteArray &bytes);
|
||||
|
||||
@@ -40,11 +58,8 @@ private:
|
||||
MTPhelp_ConfigSimple _simpleConfig;
|
||||
|
||||
QNetworkAccessManager _manager;
|
||||
std::unique_ptr<QNetworkReply> _appReply;
|
||||
std::unique_ptr<QNetworkReply> _dnsReply;
|
||||
|
||||
std::unique_ptr<DcOptions> _localOptions;
|
||||
std::unique_ptr<Instance> _localInstance;
|
||||
std::vector<Attempt> _attempts;
|
||||
std::vector<Request> _requests;
|
||||
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user