Better ping time calculation.
GitOrigin-RevId: d9cf250dae657ed498d932b2e335efbddb374c43
This commit is contained in:
parent
8253460dbb
commit
e5385cbd0b
@ -508,15 +508,16 @@ void ConnectionCreator::ping_proxy_socket_fd(SocketFd socket_fd, mtproto::Transp
|
|||||||
auto token = next_token();
|
auto token = next_token();
|
||||||
auto raw_connection =
|
auto raw_connection =
|
||||||
std::make_unique<mtproto::RawConnection>(std::move(socket_fd), std::move(transport_type), nullptr);
|
std::make_unique<mtproto::RawConnection>(std::move(socket_fd), std::move(transport_type), nullptr);
|
||||||
children_[token] = {false,
|
children_[token] = {
|
||||||
create_actor<detail::PingActor>(
|
false, create_actor<detail::PingActor>(
|
||||||
"PingActor", std::move(raw_connection),
|
"PingActor", std::move(raw_connection),
|
||||||
PromiseCreator::lambda([start = Time::now(), promise = std::move(promise)](
|
PromiseCreator::lambda(
|
||||||
Result<std::unique_ptr<mtproto::RawConnection>> result) mutable {
|
[promise = std::move(promise)](Result<std::unique_ptr<mtproto::RawConnection>> result) mutable {
|
||||||
if (result.is_error()) {
|
if (result.is_error()) {
|
||||||
return promise.set_error(Status::Error(400, result.error().message()));
|
return promise.set_error(Status::Error(400, result.error().message()));
|
||||||
}
|
}
|
||||||
promise.set_value(Time::now() - start);
|
auto ping_time = result.ok()->rtt_;
|
||||||
|
promise.set_value(std::move(ping_time));
|
||||||
}),
|
}),
|
||||||
create_reference(token))};
|
create_reference(token))};
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user