mirror of
https://github.com/ton-blockchain/ton
synced 2025-02-14 20:22:19 +00:00
Put back LastConfig callback.
This commit is contained in:
parent
d4fc3dfe7f
commit
a973a51a87
3 changed files with 18 additions and 3 deletions
|
@ -39,7 +39,7 @@ td::StringBuilder& operator<<(td::StringBuilder& sb, const LastConfigState& stat
|
|||
return sb;
|
||||
}
|
||||
|
||||
LastConfig::LastConfig(ExtClientRef client) {
|
||||
LastConfig::LastConfig(ExtClientRef client, td::unique_ptr<Callback> callback) : callback_(std::move(callback)) {
|
||||
client_.set_client(client);
|
||||
VLOG(last_block) << "State: " << state_;
|
||||
}
|
||||
|
|
|
@ -36,10 +36,17 @@ td::StringBuilder& operator<<(td::StringBuilder& sb, const LastConfigState& stat
|
|||
|
||||
class LastConfig : public td::actor::Actor {
|
||||
public:
|
||||
explicit LastConfig(ExtClientRef client);
|
||||
class Callback {
|
||||
public:
|
||||
virtual ~Callback() {
|
||||
}
|
||||
};
|
||||
|
||||
explicit LastConfig(ExtClientRef client, td::unique_ptr<Callback> callback);
|
||||
void get_last_config(td::Promise<LastConfigState> promise);
|
||||
|
||||
private:
|
||||
td::unique_ptr<Callback> callback_;
|
||||
ExtClient client_;
|
||||
LastConfigState state_;
|
||||
|
||||
|
|
|
@ -1439,9 +1439,17 @@ void TonlibClient::init_last_block(LastBlockState state) {
|
|||
}
|
||||
void TonlibClient::init_last_config() {
|
||||
ref_cnt_++;
|
||||
class Callback : public LastConfig::Callback {
|
||||
public:
|
||||
Callback(td::actor::ActorShared<TonlibClient> client) : client_(std::move(client)) {
|
||||
}
|
||||
|
||||
private:
|
||||
td::actor::ActorShared<TonlibClient> client_;
|
||||
};
|
||||
raw_last_config_ =
|
||||
td::actor::create_actor<LastConfig>(td::actor::ActorOptions().with_name("LastConfig").with_poll(false),
|
||||
get_client_ref());
|
||||
get_client_ref(), td::make_unique<Callback>(td::actor::actor_shared(this)));
|
||||
}
|
||||
|
||||
void TonlibClient::on_result(td::uint64 id, tonlib_api::object_ptr<tonlib_api::Object> response) {
|
||||
|
|
Loading…
Reference in a new issue