init
Some checks failed
Docker. / Ubuntu (push) Has been cancelled
User-agent updater. / User-agent (push) Failing after 15s
Lock Threads / lock (push) Failing after 10s
Waiting for answer. / waiting-for-answer (push) Failing after 22s
Needs user action. / needs-user-action (push) Failing after 8s
Can't reproduce. / cant-reproduce (push) Failing after 8s
Close stale issues and PRs / stale (push) Has been cancelled
Some checks failed
Docker. / Ubuntu (push) Has been cancelled
User-agent updater. / User-agent (push) Failing after 15s
Lock Threads / lock (push) Failing after 10s
Waiting for answer. / waiting-for-answer (push) Failing after 22s
Needs user action. / needs-user-action (push) Failing after 8s
Can't reproduce. / cant-reproduce (push) Failing after 8s
Close stale issues and PRs / stale (push) Has been cancelled
This commit is contained in:
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
This file is part of Telegram Desktop,
|
||||
the official desktop application for the Telegram messaging service.
|
||||
|
||||
For license and copyright information please follow this link:
|
||||
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "mtproto/details/mtproto_dc_key_creator.h"
|
||||
#include "mtproto/details/mtproto_dc_key_binder.h"
|
||||
|
||||
namespace MTP::details {
|
||||
|
||||
class SerializedRequest;
|
||||
|
||||
class BoundKeyCreator final {
|
||||
public:
|
||||
struct Delegate {
|
||||
Fn<void(base::expected<DcKeyResult, DcKeyError>)> unboundReady;
|
||||
Fn<void(uint64)> sentSome;
|
||||
Fn<void()> receivedSome;
|
||||
};
|
||||
|
||||
BoundKeyCreator(DcKeyRequest request, Delegate delegate);
|
||||
|
||||
void start(
|
||||
DcId dcId,
|
||||
int16 protocolDcId,
|
||||
not_null<AbstractConnection*> connection,
|
||||
not_null<DcOptions*> dcOptions);
|
||||
void stop();
|
||||
|
||||
void bind(AuthKeyPtr &&persistentKey);
|
||||
void restartBinder();
|
||||
[[nodiscard]] bool readyToBind() const;
|
||||
[[nodiscard]] SerializedRequest prepareBindRequest(
|
||||
const AuthKeyPtr &temporaryKey,
|
||||
uint64 sessionId);
|
||||
[[nodiscard]] DcKeyBindState handleBindResponse(
|
||||
const mtpBuffer &response);
|
||||
[[nodiscard]] AuthKeyPtr bindPersistentKey() const;
|
||||
|
||||
private:
|
||||
const DcKeyRequest _request;
|
||||
Delegate _delegate;
|
||||
|
||||
std::optional<DcKeyCreator> _creator;
|
||||
std::optional<DcKeyBinder> _binder;
|
||||
|
||||
};
|
||||
|
||||
|
||||
[[nodiscard]] bool IsDestroyedTemporaryKeyError(const mtpBuffer &buffer);
|
||||
|
||||
} // namespace MTP::details
|
||||
Reference in New Issue
Block a user