Minor fixes.

This commit is contained in:
levlam 2022-06-14 16:11:38 +03:00
parent f12da0fed5
commit 782aa6a2ec
8 changed files with 14 additions and 12 deletions

View File

@ -28,7 +28,7 @@ inline bool operator!=(const AvailableReaction &lhs, const AvailableReaction &rh
return !(lhs == rhs); return !(lhs == rhs);
} }
enum class AvailableReactionType { Unavailable, Available, NeedsPremium }; enum class AvailableReactionType : int32 { Unavailable, Available, NeedsPremium };
AvailableReactionType get_reaction_type(const vector<AvailableReaction> &reactions, const string &reaction); AvailableReactionType get_reaction_type(const vector<AvailableReaction> &reactions, const string &reaction);

View File

@ -24,6 +24,7 @@
#include "td/utils/port/RwMutex.h" #include "td/utils/port/RwMutex.h"
#include "td/utils/port/thread.h" #include "td/utils/port/thread.h"
#include "td/utils/Slice.h" #include "td/utils/Slice.h"
#include "td/utils/SliceBuilder.h"
#include "td/utils/StringBuilder.h" #include "td/utils/StringBuilder.h"
#include "td/utils/utf8.h" #include "td/utils/utf8.h"

View File

@ -264,7 +264,7 @@ void MultiSequenceDispatcherOld::send(NetQueryPtr query) {
auto &data = it_ok.first->second; auto &data = it_ok.first->second;
if (it_ok.second) { if (it_ok.second) {
LOG(DEBUG) << "Create SequenceDispatcher" << sequence_id; LOG(DEBUG) << "Create SequenceDispatcher" << sequence_id;
data.dispatcher_ = create_actor<SequenceDispatcher>("sequence dispatcher", actor_shared(this, sequence_id)); data.dispatcher_ = create_actor<SequenceDispatcher>("SequenceDispatcher", actor_shared(this, sequence_id));
} }
data.cnt_++; data.cnt_++;
query->debug(PSTRING() << "send to SequenceDispatcher " << tag("sequence_id", sequence_id)); query->debug(PSTRING() << "send to SequenceDispatcher " << tag("sequence_id", sequence_id));

View File

@ -24,6 +24,7 @@
#include "td/db/SqliteKeyValueAsync.h" #include "td/db/SqliteKeyValueAsync.h"
#include "td/db/SqliteKeyValueSafe.h" #include "td/db/SqliteKeyValueSafe.h"
#include "td/actor/actor.h"
#include "td/actor/MultiPromise.h" #include "td/actor/MultiPromise.h"
#include "td/utils/common.h" #include "td/utils/common.h"
@ -397,7 +398,7 @@ void TdDb::open(int32 scheduler_id, TdParameters parameters, DbKey key, Promise<
stop(); stop();
} }
}; };
send_closure(create_actor_on_scheduler<Worker>("worker", scheduler_id), &Worker::open, std::move(parameters), send_closure(create_actor_on_scheduler<Worker>("Worker", scheduler_id), &Worker::open, std::move(parameters),
std::move(key), std::move(promise)); std::move(key), std::move(promise));
return; return;
} }

View File

@ -31,6 +31,7 @@
#include "td/utils/format.h" #include "td/utils/format.h"
#include "td/utils/logging.h" #include "td/utils/logging.h"
#include "td/utils/misc.h" #include "td/utils/misc.h"
#include "td/utils/port/thread_local.h"
#include "td/utils/Random.h" #include "td/utils/Random.h"
#include "td/utils/Slice.h" #include "td/utils/Slice.h"
#include "td/utils/SliceBuilder.h" #include "td/utils/SliceBuilder.h"
@ -80,9 +81,8 @@ class SemaphoreActor final : public Actor {
}; };
struct Semaphore { struct Semaphore {
public:
explicit Semaphore(size_t capacity) { explicit Semaphore(size_t capacity) {
semaphore_ = create_actor<SemaphoreActor>("semaphore", capacity).release(); semaphore_ = create_actor<SemaphoreActor>("Semaphore", capacity).release();
} }
void execute(Promise<Promise<Unit>> promise) { void execute(Promise<Promise<Unit>> promise) {

View File

@ -329,7 +329,7 @@ class MasterActor final : public MsgActor {
public: public:
void loop() final { void loop() final {
alive_ = true; alive_ = true;
slave = td::create_actor<Slave>("slave", static_cast<td::ActorId<MsgActor>>(actor_id(this))); slave = td::create_actor<Slave>("Slave", static_cast<td::ActorId<MsgActor>>(actor_id(this)));
stop(); stop();
} }
td::ActorOwn<Slave> slave; td::ActorOwn<Slave> slave;

View File

@ -470,7 +470,7 @@ class Socks5TestActor final : public td::Actor {
if (r_socket.is_error()) { if (r_socket.is_error()) {
return promise.set_error(td::Status::Error(PSTRING() << "Failed to open socket: " << r_socket.error())); return promise.set_error(td::Status::Error(PSTRING() << "Failed to open socket: " << r_socket.error()));
} }
td::create_actor<td::Socks5>("socks5", r_socket.move_as_ok(), mtproto_ip_address, "", "", td::create_actor<td::Socks5>("Socks5", r_socket.move_as_ok(), mtproto_ip_address, "", "",
td::make_unique<Callback>(std::move(promise)), actor_shared(this)) td::make_unique<Callback>(std::move(promise)), actor_shared(this))
.release(); .release();
} }

View File

@ -288,7 +288,7 @@ class GetMe : public Task {
int64 user_id; int64 user_id;
int64 chat_id; int64 chat_id;
}; };
GetMe(Promise<Result> promise) : promise_(std::move(promise)) { explicit GetMe(Promise<Result> promise) : promise_(std::move(promise)) {
} }
void start_up() override { void start_up() override {
send_query(td::make_tl_object<td::td_api::getMe>(), [this](auto res) { with_user_id(res.move_as_ok()->id_); }); send_query(td::make_tl_object<td::td_api::getMe>(), [this](auto res) { with_user_id(res.move_as_ok()->id_); });
@ -424,7 +424,7 @@ class TestDownloadFile : public Task {
unlink(file.local_->path_).ignore(); unlink(file.local_->path_).ignore();
} }
size_t size = narrow_cast<size_t>(file.size_); auto size = narrow_cast<size_t>(file.size_);
Random::Xorshift128plus rnd(123); Random::Xorshift128plus rnd(123);
size_t begin = 0; size_t begin = 0;
@ -440,7 +440,7 @@ class TestDownloadFile : public Task {
begin = end; begin = end;
} }
random_shuffle(as_mutable_span(ranges_), rnd); std::random_shuffle(as_mutable_span(ranges_), rnd);
start_chunk(); start_chunk();
} }
@ -466,7 +466,7 @@ class TestDownloadFile : public Task {
} }
}; };
std::string gen_readable_file(size_t block_size, size_t block_count) { static std::string gen_readable_file(size_t block_size, size_t block_count) {
std::string content; std::string content;
for (size_t block_id = 0; block_id < block_count; block_id++) { for (size_t block_id = 0; block_id < block_count; block_id++) {
std::string block; std::string block;
@ -488,7 +488,7 @@ class TestTd : public Actor {
string api_hash; string api_hash;
}; };
TestTd(Options options) : options_(std::move(options)) { explicit TestTd(Options options) : options_(std::move(options)) {
} }
private: private: