Classified ads
|
Class that will initiate 1 or more network connections. More...
#include <networkconnectorengine.h>
Public Slots | |
void | threadIsDeleted () |
void | blackListNetworkAddr (QHostAddress aAddr) |
void | nodeConnectionAttemptStatus (Connection::ConnectionState aStatus, const Hash aHashOfAttemptedNode) |
Signals | |
void | error (QTcpSocket::SocketError socketError) |
Public Member Functions | |
NetworkConnectorEngine (Controller *aController, Model *aModel, Connection::ConnectionObserver &aObserver) | |
~NetworkConnectorEngine () | |
void | run () |
Public Attributes | |
bool | iNeedsToRun |
Private Member Functions | |
void | spawnNewConnection (const QHostAddress &aAddr, const int aPort, const Hash &aHashOfNodeToConnect) |
void | updateListOfNodesToConnect () |
bool | pruneConnectionProspectList (QList< Node * > *aListToPrune) const |
void | sendBroadCast () |
bool | tryServeWishListItem () |
void | createConnectionsToNodesStoringPrivateMessages () |
void | sendPrivateMessagesPoll (const Hash &aNodeFingerPrint) |
bool | performDNSLookup (QHostAddress *aAddressToBeSet, const QString &aFromDnsName, bool aDoWeHaveIpv6) |
Private Attributes | |
Controller * | iController |
Model * | iModel |
Connection::ConnectionObserver & | iConnectionObserver |
QList< QPair< QHostAddress, int > > | iAddressesInOrderToConnect |
QUdpSocket * | iBroadCastSocket |
time_t | iTimeOfLastBroadCast |
time_t | iTimeOfLastMsgPoll |
quint32 | iTimeOfLastMsgPollForProfile |
QList< QHostAddress > | iAddressBlacklist |
Hash | iProfileToPollPrivateMessages |
QList< Hash > | iPrivateMessagePollWishList |
Class that will initiate 1 or more network connections.
This may be notified about situation where network connection might be in order.
This will also initiate first connection to seed node, notifying controller if failed.
NetworkConnectorEngine::NetworkConnectorEngine | ( | Controller * | aController, |
Model * | aModel, | ||
Connection::ConnectionObserver & | aObserver | ||
) |
Constructor
NetworkConnectorEngine::~NetworkConnectorEngine | ( | ) |
Destructor
|
slot |
|
private |
method for creating connections to nodes that are supposed to store private messages destined to profiles whose private keys we have in this node. This is supposed to work in conjunction with ::fillBucket() that it will then, in turn, send requests to said nodes about private messages that we're supposed to receive.
|
signal |
|
slot |
|
private |
|
private |
prune from list self and nodes already connected.
aListToPrune | is list of nodes that check |
void NetworkConnectorEngine::run | ( | ) |
this class is a thread, thus run.
this method has its own execution context so it won't hurt the UI or the incoming connections.
this will ask datamodel for nodes to connect and try to arrange connections to given nodes, some will succeed and some then will be less successful.
|
private |
method for sending advertisment about node in ip protocl broadcast packet
|
private |
Sends query (poll) about private messages to given node. Node must be connected. This method polls not only private messages but also profile comments - reason for this is simple: they have the same bucket so as we're already making commections to nodes storing private messaeges we'll find the comments from same bucket.
Naturally this only helps the profile operator as he'll this way find his own comments ; for the rest of the comment-reading crowd a separate mechanism needs to be in place.
|
private |
internal method for starting a new connection
|
slot |
|
private |
Method for checking if there is anything in datamodels connection wishlist
|
private |
method for updating list of nodes to connect
|
private |
Addresses that we're supposed to not connect. This easily gets at least addresses of self in a box that has multiple network addresses (or multiple temporary ipv6 addresses)
|
private |
|
private |
|
private |
|
private |
|
private |
bool NetworkConnectorEngine::iNeedsToRun |
|
private |
|
private |
|
private |
|
private |
this is time when private messages were last polled for any profile ; this is used for sequencing the polls so that each profile gets decent and fair polling periods
|
private |
this is timestamp of last message poll for individual profile ; this is sent to remote nodes and the nodes are asked to send messages that they've received after the timestamp presented here