2018-12-31 20:04:05 +01:00
|
|
|
//
|
2022-12-31 22:28:08 +01:00
|
|
|
// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2023
|
2018-12-31 20:04:05 +01:00
|
|
|
//
|
|
|
|
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
|
|
|
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
|
|
|
//
|
|
|
|
#pragma once
|
|
|
|
|
2019-05-06 18:59:49 +02:00
|
|
|
#include "td/mtproto/AuthData.h"
|
2018-12-31 20:04:05 +01:00
|
|
|
#include "td/mtproto/RawConnection.h"
|
|
|
|
|
2019-05-22 20:17:24 +02:00
|
|
|
#include "td/utils/common.h"
|
2018-09-07 02:41:21 +02:00
|
|
|
#include "td/utils/port/detail/PollableFd.h"
|
2018-12-31 20:04:05 +01:00
|
|
|
#include "td/utils/Status.h"
|
|
|
|
|
|
|
|
namespace td {
|
|
|
|
namespace mtproto {
|
2018-06-04 18:58:54 +02:00
|
|
|
|
2019-05-06 18:59:49 +02:00
|
|
|
class PingConnection {
|
2018-12-31 20:04:05 +01:00
|
|
|
public:
|
2019-05-06 18:59:49 +02:00
|
|
|
virtual ~PingConnection() = default;
|
|
|
|
virtual PollableFdInfo &get_poll_info() = 0;
|
|
|
|
virtual unique_ptr<RawConnection> move_as_raw_connection() = 0;
|
|
|
|
virtual Status flush() = 0;
|
|
|
|
virtual bool was_pong() const = 0;
|
|
|
|
virtual double rtt() const = 0;
|
|
|
|
|
|
|
|
static unique_ptr<PingConnection> create_req_pq(unique_ptr<RawConnection> raw_connection, size_t ping_count);
|
|
|
|
static unique_ptr<PingConnection> create_ping_pong(unique_ptr<RawConnection> raw_connection,
|
|
|
|
unique_ptr<AuthData> auth_data);
|
2018-12-31 20:04:05 +01:00
|
|
|
};
|
2018-06-04 18:58:54 +02:00
|
|
|
|
2018-12-31 20:04:05 +01:00
|
|
|
} // namespace mtproto
|
|
|
|
} // namespace td
|