2019-07-05 07:54:53 +00:00
|
|
|
/*
|
|
|
|
This file is part of Telegram Desktop,
|
|
|
|
the official desktop application for the Telegram messaging service.
|
|
|
|
|
|
|
|
For license and copyright information please follow this link:
|
|
|
|
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
|
2019-12-02 13:10:19 +00:00
|
|
|
#include "mtproto/details/mtproto_abstract_socket.h"
|
2019-07-05 07:54:53 +00:00
|
|
|
|
2019-12-02 13:10:19 +00:00
|
|
|
namespace MTP::details {
|
2019-07-05 07:54:53 +00:00
|
|
|
|
2019-07-08 15:41:34 +00:00
|
|
|
class TcpSocket final : public AbstractSocket {
|
2019-07-05 07:54:53 +00:00
|
|
|
public:
|
2021-06-15 12:45:48 +00:00
|
|
|
TcpSocket(
|
|
|
|
not_null<QThread*> thread,
|
|
|
|
const QNetworkProxy &proxy,
|
|
|
|
bool protocolForFiles);
|
2019-07-05 07:54:53 +00:00
|
|
|
|
|
|
|
void connectToHost(const QString &address, int port) override;
|
2019-07-28 16:00:42 +00:00
|
|
|
bool isGoodStartNonce(bytes::const_span nonce) override;
|
2019-07-10 15:03:48 +00:00
|
|
|
void timedOut() override;
|
2019-07-05 07:54:53 +00:00
|
|
|
bool isConnected() override;
|
2019-07-08 13:56:09 +00:00
|
|
|
bool hasBytesAvailable() override;
|
2019-07-08 15:41:34 +00:00
|
|
|
int64 read(bytes::span buffer) override;
|
|
|
|
void write(bytes::const_span prefix, bytes::const_span buffer) override;
|
2019-07-05 07:54:53 +00:00
|
|
|
|
|
|
|
int32 debugState() override;
|
2022-02-07 11:24:02 +00:00
|
|
|
QString debugPostfix() const override;
|
2019-07-05 07:54:53 +00:00
|
|
|
|
|
|
|
private:
|
2019-07-08 13:56:09 +00:00
|
|
|
void handleError(int errorCode);
|
2019-07-05 07:54:53 +00:00
|
|
|
|
|
|
|
QTcpSocket _socket;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
2019-12-02 13:10:19 +00:00
|
|
|
} // namespace MTP::details
|