Classified ads
Public Slots | Signals | Public Member Functions | Public Attributes | Private Member Functions | Private Attributes | List of all members
NetworkConnectorEngine Class Reference

Class that will initiate 1 or more network connections. More...

#include <networkconnectorengine.h>

Inheritance diagram for NetworkConnectorEngine:
Inheritance graph
[legend]
Collaboration diagram for NetworkConnectorEngine:
Collaboration graph
[legend]

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

ControlleriController
 
ModeliModel
 
Connection::ConnectionObserveriConnectionObserver
 
QList< MNodeModelProtocolInterface::HostConnectQueueItemiAddressesInOrderToConnect
 
QUdpSocket * iBroadCastSocket
 
time_t iTimeOfLastBroadCast
 
time_t iTimeOfLastMsgPoll
 
quint32 iTimeOfLastMsgPollForProfile
 
QList< QHostAddress > iAddressBlacklist
 
Hash iProfileToPollPrivateMessages
 
QList< HashiPrivateMessagePollWishList
 

Detailed Description

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.

Constructor & Destructor Documentation

NetworkConnectorEngine::NetworkConnectorEngine ( Controller aController,
Model aModel,
Connection::ConnectionObserver aObserver 
)

Constructor

NetworkConnectorEngine::~NetworkConnectorEngine ( )

Destructor

Member Function Documentation

void NetworkConnectorEngine::blackListNetworkAddr ( QHostAddress  aAddr)
slot
void NetworkConnectorEngine::createConnectionsToNodesStoringPrivateMessages ( )
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.

void NetworkConnectorEngine::error ( QTcpSocket::SocketError  socketError)
signal
void NetworkConnectorEngine::nodeConnectionAttemptStatus ( Connection::ConnectionState  aStatus,
const Hash  aHashOfAttemptedNode 
)
slot
bool NetworkConnectorEngine::performDNSLookup ( QHostAddress *  aAddressToBeSet,
const QString &  aFromDnsName,
bool  aDoWeHaveIpv6 
)
private
bool NetworkConnectorEngine::pruneConnectionProspectList ( QList< Node * > *  aListToPrune) const
private

prune from list self and nodes already connected.

Parameters
aListToPruneis list of nodes that check
Returns
this will return true if there were at least one node that was already connected
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.

void NetworkConnectorEngine::sendBroadCast ( )
private

method for sending advertisement about node in ip protocl broadcast packet

void NetworkConnectorEngine::sendPrivateMessagesPoll ( const Hash aNodeFingerPrint)
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.

void NetworkConnectorEngine::spawnNewConnection ( const QHostAddress &  aAddr,
const int  aPort,
const Hash aHashOfNodeToConnect 
)
private

internal method for starting a new connection

void NetworkConnectorEngine::threadIsDeleted ( )
slot
bool NetworkConnectorEngine::tryServeWishListItem ( )
private

Method for checking if there is anything in datamodels connection wishlist

void NetworkConnectorEngine::updateListOfNodesToConnect ( )
private

method for updating list of nodes to connect

Member Data Documentation

QList<QHostAddress> NetworkConnectorEngine::iAddressBlacklist
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)

QList<MNodeModelProtocolInterface::HostConnectQueueItem> NetworkConnectorEngine::iAddressesInOrderToConnect
private
QUdpSocket* NetworkConnectorEngine::iBroadCastSocket
private
Connection::ConnectionObserver& NetworkConnectorEngine::iConnectionObserver
private
Controller* NetworkConnectorEngine::iController
private
Model* NetworkConnectorEngine::iModel
private
bool NetworkConnectorEngine::iNeedsToRun
QList<Hash> NetworkConnectorEngine::iPrivateMessagePollWishList
private
Hash NetworkConnectorEngine::iProfileToPollPrivateMessages
private
time_t NetworkConnectorEngine::iTimeOfLastBroadCast
private
time_t NetworkConnectorEngine::iTimeOfLastMsgPoll
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

quint32 NetworkConnectorEngine::iTimeOfLastMsgPollForProfile
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


The documentation for this class was generated from the following file: