Update stats on proxy errors
GitOrigin-RevId: 0c258335f5b3cd540edd5f8adf95befc29bf91bb
This commit is contained in:
parent
81cb9da887
commit
ad3a1a35c5
@ -724,10 +724,12 @@ ActorOwn<> ConnectionCreator::prepare_connection(SocketFd socket_fd, const Proxy
|
|||||||
class Callback : public TransparentProxy::Callback {
|
class Callback : public TransparentProxy::Callback {
|
||||||
public:
|
public:
|
||||||
explicit Callback(Promise<ConnectionData> promise,
|
explicit Callback(Promise<ConnectionData> promise,
|
||||||
unique_ptr<mtproto::RawConnection::StatsCallback> stats_callback, bool use_connection_token)
|
unique_ptr<mtproto::RawConnection::StatsCallback> stats_callback, bool use_connection_token,
|
||||||
|
bool was_connected)
|
||||||
: promise_(std::move(promise))
|
: promise_(std::move(promise))
|
||||||
, stats_callback_(std::move(stats_callback))
|
, stats_callback_(std::move(stats_callback))
|
||||||
, use_connection_token_(use_connection_token) {
|
, use_connection_token_(use_connection_token)
|
||||||
|
, was_connected_(was_connected) {
|
||||||
}
|
}
|
||||||
void set_result(Result<SocketFd> result) override {
|
void set_result(Result<SocketFd> result) override {
|
||||||
if (result.is_error()) {
|
if (result.is_error()) {
|
||||||
@ -756,13 +758,14 @@ ActorOwn<> ConnectionCreator::prepare_connection(SocketFd socket_fd, const Proxy
|
|||||||
private:
|
private:
|
||||||
Promise<ConnectionData> promise_;
|
Promise<ConnectionData> promise_;
|
||||||
StateManager::ConnectionToken connection_token_;
|
StateManager::ConnectionToken connection_token_;
|
||||||
bool was_connected_{false};
|
|
||||||
unique_ptr<mtproto::RawConnection::StatsCallback> stats_callback_;
|
unique_ptr<mtproto::RawConnection::StatsCallback> stats_callback_;
|
||||||
bool use_connection_token_;
|
bool use_connection_token_;
|
||||||
|
bool was_connected_{false};
|
||||||
};
|
};
|
||||||
LOG(INFO) << "Start " << (proxy.use_socks5_proxy() ? "Socks5" : (proxy.use_http_tcp_proxy() ? "HTTP" : "TLS"))
|
LOG(INFO) << "Start " << (proxy.use_socks5_proxy() ? "Socks5" : (proxy.use_http_tcp_proxy() ? "HTTP" : "TLS"))
|
||||||
<< ": " << debug_str;
|
<< ": " << debug_str;
|
||||||
auto callback = make_unique<Callback>(std::move(promise), std::move(stats_callback), use_connection_token);
|
auto callback = make_unique<Callback>(std::move(promise), std::move(stats_callback), use_connection_token,
|
||||||
|
!proxy.use_socks5_proxy());
|
||||||
if (proxy.use_socks5_proxy()) {
|
if (proxy.use_socks5_proxy()) {
|
||||||
return ActorOwn<>(create_actor<Socks5>(PSLICE() << actor_name_prefix << "Socks5", std::move(socket_fd),
|
return ActorOwn<>(create_actor<Socks5>(PSLICE() << actor_name_prefix << "Socks5", std::move(socket_fd),
|
||||||
mtproto_ip, proxy.user().str(), proxy.password().str(),
|
mtproto_ip, proxy.user().str(), proxy.password().str(),
|
||||||
|
Reference in New Issue
Block a user