Add PingProxy actor name.

GitOrigin-RevId: b539817bad2d706df3391619cd2c81324b8dc686
This commit is contained in:
levlam 2020-06-10 20:34:45 +03:00
parent 44689f81ff
commit 8a118ec305
3 changed files with 15 additions and 15 deletions

View File

@ -19,9 +19,8 @@
namespace td { namespace td {
namespace mtproto { namespace mtproto {
ActorOwn<> create_ping_actor(std::string debug, unique_ptr<RawConnection> raw_connection, ActorOwn<> create_ping_actor(string debug, unique_ptr<RawConnection> raw_connection, unique_ptr<AuthData> auth_data,
unique_ptr<AuthData> auth_data, Promise<unique_ptr<RawConnection>> promise, Promise<unique_ptr<RawConnection>> promise, ActorShared<> parent) {
ActorShared<> parent) {
class PingActor : public Actor { class PingActor : public Actor {
public: public:
PingActor(unique_ptr<RawConnection> raw_connection, unique_ptr<AuthData> auth_data, PingActor(unique_ptr<RawConnection> raw_connection, unique_ptr<AuthData> auth_data,

View File

@ -327,11 +327,11 @@ void ConnectionCreator::ping_proxy(int32 proxy_id, Promise<double> promise) {
continue; continue;
} }
ping_proxy_socket_fd(r_socket_fd.move_as_ok(), r_transport_type.move_as_ok(), ping_proxy_socket_fd(
PromiseCreator::lambda([actor_id = actor_id(this), token](Result<double> result) { r_socket_fd.move_as_ok(), r_transport_type.move_as_ok(), PSTRING() << info.option->get_ip_address(),
send_closure(actor_id, &ConnectionCreator::on_ping_main_dc_result, token, PromiseCreator::lambda([actor_id = actor_id(this), token](Result<double> result) {
std::move(result)); send_closure(actor_id, &ConnectionCreator::on_ping_main_dc_result, token, std::move(result));
})); }));
} }
return; return;
} }
@ -367,14 +367,14 @@ void ConnectionCreator::ping_proxy_resolved(int32 proxy_id, IPAddress ip_address
} }
auto socket_fd = r_socket_fd.move_as_ok(); auto socket_fd = r_socket_fd.move_as_ok();
auto connection_promise = auto connection_promise = PromiseCreator::lambda(
PromiseCreator::lambda([promise = std::move(promise), actor_id = actor_id(this), [promise = std::move(promise), actor_id = actor_id(this), transport_type = extra.transport_type,
transport_type = extra.transport_type](Result<ConnectionData> r_connection_data) mutable { debug_str = std::move(extra.debug_str)](Result<ConnectionData> r_connection_data) mutable {
if (r_connection_data.is_error()) { if (r_connection_data.is_error()) {
return promise.set_error(Status::Error(400, r_connection_data.error().public_message())); return promise.set_error(Status::Error(400, r_connection_data.error().public_message()));
} }
send_closure(actor_id, &ConnectionCreator::ping_proxy_socket_fd, r_connection_data.move_as_ok().socket_fd, send_closure(actor_id, &ConnectionCreator::ping_proxy_socket_fd, r_connection_data.move_as_ok().socket_fd,
std::move(transport_type), std::move(promise)); std::move(transport_type), std::move(debug_str), std::move(promise));
}); });
CHECK(proxy.use_proxy()); CHECK(proxy.use_proxy());
auto token = next_token(); auto token = next_token();
@ -387,11 +387,11 @@ void ConnectionCreator::ping_proxy_resolved(int32 proxy_id, IPAddress ip_address
} }
void ConnectionCreator::ping_proxy_socket_fd(SocketFd socket_fd, mtproto::TransportType transport_type, void ConnectionCreator::ping_proxy_socket_fd(SocketFd socket_fd, mtproto::TransportType transport_type,
Promise<double> promise) { string debug_str, Promise<double> promise) {
auto token = next_token(); auto token = next_token();
auto raw_connection = make_unique<mtproto::RawConnection>(std::move(socket_fd), std::move(transport_type), nullptr); auto raw_connection = make_unique<mtproto::RawConnection>(std::move(socket_fd), std::move(transport_type), nullptr);
children_[token] = { children_[token] = {
false, create_ping_actor("", std::move(raw_connection), nullptr, false, create_ping_actor(std::move(debug_str), std::move(raw_connection), nullptr,
PromiseCreator::lambda([promise = std::move(promise)]( PromiseCreator::lambda([promise = std::move(promise)](
Result<unique_ptr<mtproto::RawConnection>> result) mutable { Result<unique_ptr<mtproto::RawConnection>> result) mutable {
if (result.is_error()) { if (result.is_error()) {

View File

@ -243,7 +243,8 @@ class ConnectionCreator : public NetQueryCallback {
void ping_proxy_resolved(int32 proxy_id, IPAddress ip_address, Promise<double> promise); void ping_proxy_resolved(int32 proxy_id, IPAddress ip_address, Promise<double> promise);
void ping_proxy_socket_fd(SocketFd socket_fd, mtproto::TransportType transport_type, Promise<double> promise); void ping_proxy_socket_fd(SocketFd socket_fd, mtproto::TransportType transport_type, string debug_str,
Promise<double> promise);
void on_ping_main_dc_result(uint64 token, Result<double> result); void on_ping_main_dc_result(uint64 token, Result<double> result);
}; };