Remove thread 4 from tg_cli.

GitOrigin-RevId: eca37443e076ab504e6be0f8852ae91049cf0bb3
This commit is contained in:
levlam 2018-09-11 13:37:44 +03:00
parent 25b209fec1
commit c20e1612d8

View File

@ -221,7 +221,8 @@ StringBuilder &operator<<(StringBuilder &sb, const SendMessageInfo &info) {
class CliClient final : public Actor { class CliClient final : public Actor {
public: public:
CliClient(ConcurrentScheduler *scheduler, bool use_test_dc, bool get_chat_list, bool disable_network, int32 api_id, string api_hash) CliClient(ConcurrentScheduler *scheduler, bool use_test_dc, bool get_chat_list, bool disable_network, int32 api_id,
string api_hash)
: scheduler_(scheduler) : scheduler_(scheduler)
, use_test_dc_(use_test_dc) , use_test_dc_(use_test_dc)
, get_chat_list_(get_chat_list) , get_chat_list_(get_chat_list)
@ -3442,7 +3443,7 @@ class CliClient final : public Actor {
int32 my_id_ = 0; int32 my_id_ = 0;
ConcurrentScheduler *scheduler_{ nullptr }; ConcurrentScheduler *scheduler_{nullptr};
bool use_test_dc_ = false; bool use_test_dc_ = false;
ActorOwn<ClientActor> td_; ActorOwn<ClientActor> td_;
@ -3512,7 +3513,7 @@ void main(int argc, char **argv) {
if (x) { if (x) {
return x; return x;
} }
return ""; return std::string();
}(std::getenv("TD_API_HASH")); }(std::getenv("TD_API_HASH"));
// TODO port OptionsParser to Windows // TODO port OptionsParser to Windows
for (int i = 1; i < argc; i++) { for (int i = 1; i < argc; i++) {
@ -3558,7 +3559,7 @@ void main(int argc, char **argv) {
} }
} }
if (api_id == 0 || api_hash == "") { if (api_id == 0 || api_hash.empty()) {
LOG(ERROR) << "You should provide some valid api_id and api_hash"; LOG(ERROR) << "You should provide some valid api_id and api_hash";
return usage(); return usage();
} }
@ -3567,10 +3568,11 @@ void main(int argc, char **argv) {
{ {
ConcurrentScheduler scheduler; ConcurrentScheduler scheduler;
scheduler.init(4); scheduler.init(3);
scheduler scheduler
.create_actor_unsafe<CliClient>(0, "CliClient", &scheduler, use_test_dc, get_chat_list, disable_network, api_id, api_hash) .create_actor_unsafe<CliClient>(0, "CliClient", &scheduler, use_test_dc, get_chat_list, disable_network, api_id,
api_hash)
.release(); .release();
scheduler.start(); scheduler.start();