QcTcpTransport Class
A transport over TCP (decision E-251): frames with a length prefix (QcFrameReader), a keep-alive frame when nothing was sent for a while, a timeout when nothing arrives, and a bound for the bytes waiting to be sent, beyond which a peer counts as too slow and is cut off. More...
| Header: | #include <network/QcTcpTransport.h> |
| Inherits: | QcTransport |
Public Types
| struct | Limits |
Public Functions
| QcTcpTransport(QTcpSocket *socket, const QcTcpTransport::Limits &limits, QObject *parent = nullptr) | |
| QcTcpTransport(const QcTcpTransport &) | |
| QcTcpTransport(QcTcpTransport &&) | |
| QcTcpTransport & | operator=(QcTcpTransport &&) |
| QcTcpTransport & | operator=(const QcTcpTransport &) |
Reimplemented Public Functions
| virtual void | close() override |
| virtual QString | closeReason() const override |
| virtual bool | closedByPeer() const override |
| virtual bool | isOpen() const override |
| virtual bool | keepsItsThread() const override |
| virtual QString | peerAddress() const override |
| virtual void | peerSaidGoodbye() override |
| virtual qint64 | pendingBytes() const override |
| virtual void | sendFrame(const QByteArray &frame) override |
Static Public Members
| void | finishLingering() |
Detailed Description
Lives in the thread of its socket (server thread, the client's session tick thread or GUI thread). The socket may be a QSslSocket (decision E-872): frames written before its handshake ends wait and go out encrypted. A transport over TLS never changes threads (keepsItsThread()).
Member Function Documentation
QcTcpTransport::QcTcpTransport(QTcpSocket *socket, const QcTcpTransport::Limits &limits, QObject *parent = nullptr)
Takes over the connected socket with limits, as a child of parent.
[delete] QcTcpTransport::QcTcpTransport(const QcTcpTransport &)
Copy-constructs an instance of QcTcpTransport. This function is deleted.
[delete] QcTcpTransport::QcTcpTransport(QcTcpTransport &&)
Move-constructs an instance of QcTcpTransport. This function is deleted.
[override virtual] void QcTcpTransport::close()
Reimplements: QcTransport::close().
[override virtual] QString QcTcpTransport::closeReason() const
Reimplements: QcTransport::closeReason() const.
[override virtual] bool QcTcpTransport::closedByPeer() const
Reimplements: QcTransport::closedByPeer() const.
[static] void QcTcpTransport::finishLingering()
Runs the calling thread's event loop until the sockets lingering in it (destroyed transports still in their goodbye, QcTcpGoodbye) are closed, at most 1 s, and ends the rest; for a thread that is about to end, which would otherwise cut them off at once. Returns at once in a thread without.
[override virtual] bool QcTcpTransport::isOpen() const
Reimplements: QcTransport::isOpen() const.
[override virtual] bool QcTcpTransport::keepsItsThread() const
Reimplements: QcTransport::keepsItsThread() const.
Returns true over TLS: Qt's OpenSSL backend keeps the socket's TLS state in an object of its own that stays in the thread the socket was made in (decision E-872).
[override virtual] QString QcTcpTransport::peerAddress() const
Reimplements: QcTransport::peerAddress() const.
[override virtual] void QcTcpTransport::peerSaidGoodbye()
Reimplements: QcTransport::peerSaidGoodbye().
[override virtual] qint64 QcTcpTransport::pendingBytes() const
Reimplements: QcTransport::pendingBytes() const.
[override virtual] void QcTcpTransport::sendFrame(const QByteArray &frame)
Reimplements: QcTransport::sendFrame(const QByteArray &frame).
[delete] QcTcpTransport &QcTcpTransport::operator=(QcTcpTransport &&)
Move-assigns other to this QcTcpTransport instance. This function is deleted.
[delete] QcTcpTransport &QcTcpTransport::operator=(const QcTcpTransport &)
Copy-assigns other to this QcTcpTransport instance. This function is deleted.