mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-06-02 13:12:16 -04:00
Done most of the piping/callback between the DHT and LinkMgr/NetMgr.
* Added ConnectionFeedback fn to NetAssistConnect & p3BitDht. * Added TYPE definitions to pqiassist.h * added extra parameters to p3LinkMgr::connectAttempt() (flags which will be used to pass DIRECT/PROXY/DIRECT + PASSIVE/ACTIVE) * Added callback from p3LinkMgr to NetMgr::netAssistStatusUpdate() => Dht::ConnectionFeedback. * updated peerConnectRequest to trigger either TCP attempt (first) or UDP connection. * updated parameters for p3LinkMgrIMPL::tryConnectUDP() * added p3LinkMgrIMPL::locked_ConnectAttempt_SpecificAddress() for DHT => TCP attempt. * added extra parameter to addAddressIfUnique... bool addFront => DHT attempts get pushed to front of Queue due to timing requirements. * added extra parameter (flags) to pqiperson::connect() - matches extra parameters to p3LinkMgr::connectAttempt(). * added p3NetMgr::netAssistStatusUpdate() * added mConnectFlags to pqissludp git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5-netupgrade@4443 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
8d5bde1b50
commit
387db6e7b6
15 changed files with 275 additions and 49 deletions
|
@ -169,6 +169,9 @@ virtual bool getNetworkStats(uint32_t &netsize, uint32_t &localnetsize);
|
|||
virtual bool findPeer(std::string id);
|
||||
virtual bool dropPeer(std::string id);
|
||||
|
||||
/* feedback on success failure of Connections */
|
||||
virtual void ConnectionFeedback(std::string pid, int state);
|
||||
|
||||
/* extract current peer status */
|
||||
virtual bool getPeerStatus(std::string id,
|
||||
struct sockaddr_in &laddr, struct sockaddr_in &raddr,
|
||||
|
@ -181,12 +184,16 @@ virtual bool getExternalInterface(struct sockaddr_in &raddr,
|
|||
* hould all be removed from NetAssist?
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/* pqiNetAssistConnect - external interface functions */
|
||||
|
||||
|
||||
/***********************************************************************************************
|
||||
****************************** Connections (p3bitdht_peernet.cc) ******************************
|
||||
************************************************************************************************/
|
||||
/* Feedback from RS Upper Layers */
|
||||
//virtual void ConnectionFeedback(std::string pid, int state);
|
||||
|
||||
/* Callback functions - from bitdht */
|
||||
int NodeCallback(const bdId *id, uint32_t peerflags);
|
||||
|
@ -213,6 +220,7 @@ void Feedback_ConnectionFailed(std::string pid);
|
|||
void UdpConnectionFailed_locked(DhtPeerDetails *dpd);
|
||||
void Feedback_ConnectionClosed(std::string pid);
|
||||
|
||||
|
||||
/***********************************************************************************************
|
||||
************************** Internal Accounting (p3bitdht_peers.cc) ****************************
|
||||
************************************************************************************************/
|
||||
|
|
|
@ -1357,6 +1357,10 @@ int p3BitDht::checkConnectionAllowed(const bdId *peerId, int mode)
|
|||
/* So initiateConnection has to call out to other bits of RS.
|
||||
* critical information is:
|
||||
* Peer RsId, Peer Address, Connect Mode (includes Proxy/OrNot).
|
||||
|
||||
*
|
||||
* What do we need: ACTIVE / PASSIVE / UNSPEC
|
||||
* + Min Delay Time,
|
||||
*/
|
||||
|
||||
|
||||
|
@ -1760,4 +1764,34 @@ void p3BitDht::Feedback_ConnectionClosed(std::string pid)
|
|||
|
||||
|
||||
|
||||
void p3BitDht::ConnectionFeedback(std::string pid, int mode)
|
||||
{
|
||||
std::cerr << "p3BitDht::ConnectionFeedback() peer: " << pid;
|
||||
std::cerr << " mode: " << mode;
|
||||
std::cerr << std::endl;
|
||||
|
||||
switch(mode)
|
||||
{
|
||||
case NETMGR_DHT_FEEDBACK_CONNECTED:
|
||||
std::cerr << "p3BitDht::ConnectionFeedback() HAVE CONNECTED (tcp?/udp) to peer: " << pid;
|
||||
std::cerr << std::endl;
|
||||
|
||||
Feedback_Connected(pid);
|
||||
break;
|
||||
|
||||
case NETMGR_DHT_FEEDBACK_CONN_FAILED:
|
||||
std::cerr << "p3BitDht::ConnectionFeedback() UDP CONNECTION FAILED to peer: " << pid;
|
||||
std::cerr << std::endl;
|
||||
Feedback_ConnectionFailed(pid);
|
||||
break;
|
||||
|
||||
case NETMGR_DHT_FEEDBACK_CONN_CLOSED:
|
||||
std::cerr << "p3BitDht::ConnectionFeedback() CONNECTION (tcp?/udp) CLOSED to peer: " << pid;
|
||||
std::cerr << std::endl;
|
||||
Feedback_ConnectionClosed(pid);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue