QtBase
v6.3.1
|
#include <peerwireclient.h>
Additional Inherited Members | |
Public Slots inherited from QObject | |
void | deleteLater () |
Static Public Member Functions inherited from QObject | |
static QMetaObject::Connection | connect (const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection) |
static QMetaObject::Connection | connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type=Qt::AutoConnection) |
template<typename Func1 , typename Func2 > | |
static QMetaObject::Connection | connect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const typename QtPrivate::FunctionPointer< Func2 >::Object *receiver, Func2 slot, Qt::ConnectionType type=Qt::AutoConnection) |
static QMetaObject::Connection ::type | connect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, Func2 slot) |
static QMetaObject::Connection ::type | connect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const QObject *context, Func2 slot, Qt::ConnectionType type=Qt::AutoConnection) |
template<typename Func1 , typename Func2 > | |
static std::enable_if< QtPrivate::FunctionPointer< Func2 >::ArgumentCount==-1 &&!std::is_convertible_v< Func2, const char * >, QMetaObject::Connection >::type | connect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, Func2 slot) |
template<typename Func1 , typename Func2 > | |
static std::enable_if< QtPrivate::FunctionPointer< Func2 >::ArgumentCount==-1 &&!std::is_convertible_v< Func2, const char * >, QMetaObject::Connection >::type | connect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const QObject *context, Func2 slot, Qt::ConnectionType type=Qt::AutoConnection) |
static bool | disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *member) |
static bool | disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &member) |
static bool | disconnect (const QMetaObject::Connection &) |
template<typename Func1 , typename Func2 > | |
static bool | disconnect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const typename QtPrivate::FunctionPointer< Func2 >::Object *receiver, Func2 slot) |
template<typename Func1 > | |
static bool | disconnect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const QObject *receiver, void **zero) |
Static Public Attributes inherited from QAbstractSocket | |
static constexpr auto | IPv4Protocol = QHostAddress::IPv4Protocol |
static constexpr auto | IPv6Protocol = QHostAddress::IPv6Protocol |
static constexpr auto | AnyIPProtocol = QHostAddress::AnyIPProtocol |
static constexpr auto | UnknownNetworkLayerProtocol = QHostAddress::UnknownNetworkLayerProtocol |
Protected Attributes inherited from QObject | |
QScopedPointer< QObjectData > | d_ptr |
Properties inherited from QObject | |
QString | objectName |
the name of this object More... | |
Related Functions inherited from QObject | |
template< class T > T | qobject_cast (const QObject *object) |
template< typename T > T | qFindChildqFindChildren (const QObject *obj, const QString &name)() |
template< typename T > QList< T > | qFindChildrenqFindChildren (const QObject *obj, const QString &name)() |
QObjectList | |
Definition at line 82 of file peerwireclient.h.
Enumerator | |
---|---|
ChokingPeer | |
InterestedInPeer | |
ChokedByPeer | |
PeerIsInterested |
Definition at line 87 of file peerwireclient.h.
|
explicit |
QBitArray PeerWireClient::availablePieces | ( | ) | const |
|
signal |
|
signal |
|
inlineoverridevirtual |
Returns the number of bytes that are available for reading. This function is commonly used with sequential devices to determine the number of bytes to allocate in a buffer before reading.
Subclasses that reimplement this function must call the base implementation in order to include the size of the buffer of QIODevice. Example:
Reimplemented from QIODevice.
Definition at line 125 of file peerwireclient.h.
void PeerWireClient::cancelRequest | ( | int | piece, |
int | offset, | ||
int | length | ||
) |
Definition at line 273 of file peerwireclient.cpp.
bool PeerWireClient::canTransferMore | ( | ) | const |
|
signal |
void PeerWireClient::chokePeer | ( | ) |
|
overridevirtual |
Attempts to make a connection to hostName on the given port. The protocol parameter can be used to specify which network protocol to use (eg. IPv4 or IPv6).
The socket is opened in the given openMode and first enters HostLookupState, then performs a host name lookup of hostName. If the lookup succeeds, hostFound() is emitted and QAbstractSocket enters ConnectingState. It then attempts to connect to the address or addresses returned by the lookup. Finally, if a connection is established, QAbstractSocket enters ConnectedState and emits connected().
At any point, the socket can emit errorOccurred() to signal that an error occurred.
hostName may be an IP address in string form (e.g., "43.195.83.32"), or it may be a host name (e.g., "example.com"). QAbstractSocket will do a lookup only if required. port is in native byte order.
Reimplemented from QAbstractSocket.
Definition at line 400 of file peerwireclient.cpp.
void PeerWireClient::diconnectFromHost | ( | ) |
qint64 PeerWireClient::downloadSpeed | ( | ) | const |
Definition at line 371 of file peerwireclient.cpp.
QList< TorrentBlock > PeerWireClient::incomingBlocks | ( | ) | const |
Definition at line 144 of file peerwireclient.cpp.
|
signal |
void PeerWireClient::initialize | ( | const QByteArray & | infoHash, |
int | pieceCount | ||
) |
Definition at line 121 of file peerwireclient.cpp.
|
signal |
|
signal |
TorrentPeer * PeerWireClient::peer | ( | ) | const |
|
inline |
Definition at line 102 of file peerwireclient.h.
Reads up to maxSize bytes from the device into data, and returns the number of bytes read or -1 if an error occurred.
If there are no bytes to be read and there can never be more bytes available (examples include socket closed, pipe closed, sub-process finished), this function returns -1.
This function is called by QIODevice. Reimplement this function when creating a subclass of QIODevice.
When reimplementing this function it is important that this function reads all the required data before returning. This is required in order for QDataStream to be able to operate on the class. QDataStream assumes all the requested information was read and therefore does not retry reading if there was a problem.
This function might be called with a maxSize of 0, which can be used to perform post-reading operations.
Implements QIODevice.
Definition at line 654 of file peerwireclient.cpp.
Reads up to maxSize characters into data and returns the number of characters read.
This function is called by readLine(), and provides its base implementation, using getChar(). Buffered devices can improve the performance of readLine() by reimplementing this function.
readLine() appends a '\0' byte to data; readLineData() does not need to do this.
If you reimplement this function, be careful to return the correct value: it should return the number of bytes read in this line, including the terminating newline, or 0 if there is no line to be read at this point. If an error occurs, it should return -1 if and only if no bytes were read. Reading past EOF is considered an error.
Reimplemented from QIODevice.
Definition at line 662 of file peerwireclient.cpp.
|
signal |
void PeerWireClient::requestBlock | ( | int | piece, |
int | offset, | ||
int | length | ||
) |
Definition at line 250 of file peerwireclient.cpp.
void PeerWireClient::sendBlock | ( | int | piece, |
int | offset, | ||
const QByteArray & | data | ||
) |
Definition at line 289 of file peerwireclient.cpp.
void PeerWireClient::sendInterested | ( | ) |
void PeerWireClient::sendKeepAlive | ( | ) |
Definition at line 176 of file peerwireclient.cpp.
void PeerWireClient::sendNotInterested | ( | ) |
Definition at line 220 of file peerwireclient.cpp.
void PeerWireClient::sendPieceNotification | ( | int | piece | ) |
Definition at line 209 of file peerwireclient.cpp.
void PeerWireClient::setPeer | ( | TorrentPeer * | peer | ) |
Sets the size of QAbstractSocket's internal read buffer to be size bytes.
If the buffer size is limited to a certain size, QAbstractSocket won't buffer more than this size of data. Exceptionally, a buffer size of 0 means that the read buffer is unlimited and all incoming data is buffered. This is the default.
This option is useful if you only read the data at certain points in time (e.g., in a real-time streaming application) or if you want to protect your socket against receiving too much data, which may eventually cause your application to run out of memory.
Only QTcpSocket uses QAbstractSocket's internal buffer; QUdpSocket does not use any buffering at all, but rather relies on the implicit buffering provided by the operating system. Because of this, calling this function on QUdpSocket has no effect.
Reimplemented from QAbstractSocket.
Definition at line 389 of file peerwireclient.cpp.
|
inline |
|
inline |
|
overrideprotectedvirtual |
This event handler can be reimplemented in a subclass to receive timer events for the object.
QTimer provides a higher-level interface to the timer functionality, and also more general information about timers. The timer event is passed in the event parameter.
Reimplemented from QObject.
Definition at line 412 of file peerwireclient.cpp.
|
signal |
void PeerWireClient::unchokePeer | ( | ) |
qint64 PeerWireClient::uploadSpeed | ( | ) | const |
Definition at line 381 of file peerwireclient.cpp.
Writes up to maxSize bytes from data to the device. Returns the number of bytes written, or -1 if an error occurred.
This function is called by QIODevice. Reimplement this function when creating a subclass of QIODevice.
When reimplementing this function it is important that this function writes all the data available before returning. This is required in order for QDataStream to be able to operate on the class. QDataStream assumes all the information was written and therefore does not retry writing if there was a problem.
Implements QIODevice.
Definition at line 667 of file peerwireclient.cpp.