tdesktop/Telegram/SourceFiles/mtproto/details/mtproto_tcp_socket.h

40 lines
989 B
C
Raw Normal View History

/*
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-12-02 13:10:19 +00:00
namespace MTP::details {
class TcpSocket final : public AbstractSocket {
public:
TcpSocket(
not_null<QThread*> thread,
const QNetworkProxy &proxy,
bool protocolForFiles);
void connectToHost(const QString &address, int port) override;
2019-07-28 16:00:42 +00:00
bool isGoodStartNonce(bytes::const_span nonce) override;
void timedOut() override;
bool isConnected() override;
2019-07-08 13:56:09 +00:00
bool hasBytesAvailable() override;
int64 read(bytes::span buffer) override;
void write(bytes::const_span prefix, bytes::const_span buffer) override;
int32 debugState() override;
2022-02-07 11:24:02 +00:00
QString debugPostfix() const override;
private:
2019-07-08 13:56:09 +00:00
void handleError(int errorCode);
QTcpSocket _socket;
};
2019-12-02 13:10:19 +00:00
} // namespace MTP::details