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 raw_connection =
|
||||
std::make_unique<mtproto::RawConnection>(std::move(socket_fd), std::move(transport_type), nullptr);
|
||||
children_[token] = {false,
|
||||
create_actor<detail::PingActor>(
|
||||
children_[token] = {
|
||||
false, create_actor<detail::PingActor>(
|
||||
"PingActor", std::move(raw_connection),
|
||||
PromiseCreator::lambda([start = Time::now(), promise = std::move(promise)](
|
||||
Result<std::unique_ptr<mtproto::RawConnection>> result) mutable {
|
||||
PromiseCreator::lambda(
|
||||
[promise = std::move(promise)](Result<std::unique_ptr<mtproto::RawConnection>> result) mutable {
|
||||
if (result.is_error()) {
|
||||
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))};
|
||||
}
|
||||
|
Reference in New Issue
Block a user