From 5322040d29c9b1ffa4a91e229543f0024588d78c Mon Sep 17 00:00:00 2001 From: drbob Date: Wed, 11 Sep 2013 07:00:33 +0000 Subject: [PATCH] disabled outgoing normal connections - if hidden node. git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.6-initdev@6730 b45a01b8-16f6-495d-af2f-9b41ad6348cc --- libretroshare/src/pqi/p3linkmgr.cc | 13 +++++++++++++ libretroshare/src/pqi/p3peermgr.cc | 7 +++++++ libretroshare/src/pqi/p3peermgr.h | 2 ++ libretroshare/src/pqi/pqisslproxy.cc | 2 ++ 4 files changed, 24 insertions(+) diff --git a/libretroshare/src/pqi/p3linkmgr.cc b/libretroshare/src/pqi/p3linkmgr.cc index dbc56daf1..0f95d11e0 100644 --- a/libretroshare/src/pqi/p3linkmgr.cc +++ b/libretroshare/src/pqi/p3linkmgr.cc @@ -1478,6 +1478,13 @@ bool p3LinkMgrIMPL::tryConnectUDP(const std::string &id, struct sockaddr_in &r return false; #endif + if (mPeerMgr->isHidden()) + { + std::cerr << "p3LinkMgrIMPL::tryConnectUDP() isHidden(): no connection attempts for : " << id; + std::cerr << std::endl; + return false; + } + RsStackMutex stack(mLinkMtx); /****** STACK LOCK MUTEX *******/ @@ -1617,6 +1624,12 @@ bool p3LinkMgrIMPL::retryConnectTCP(const std::string &id) return false; } + if (mPeerMgr->isHidden()) + { + std::cerr << "p3LinkMgrIMPL::retryConnectTCP() isHidden(): no connection attempts for : " << id; + std::cerr << std::endl; + return false; + } struct sockaddr_in lAddr; struct sockaddr_in eAddr; diff --git a/libretroshare/src/pqi/p3peermgr.cc b/libretroshare/src/pqi/p3peermgr.cc index cef80f5cf..272bef347 100644 --- a/libretroshare/src/pqi/p3peermgr.cc +++ b/libretroshare/src/pqi/p3peermgr.cc @@ -308,6 +308,13 @@ bool p3PeerMgrIMPL::getGpgId(const std::string &ssl_id, std::string &gpgId) /**** HIDDEN STUFF ****/ +bool p3PeerMgrIMPL::isHidden() +{ + RsStackMutex stack(mPeerMtx); /****** STACK LOCK MUTEX *******/ + return mOwnState.hiddenNode; +} + + bool p3PeerMgrIMPL::isHiddenPeer(const std::string &ssl_id) { RsStackMutex stack(mPeerMtx); /****** STACK LOCK MUTEX *******/ diff --git a/libretroshare/src/pqi/p3peermgr.h b/libretroshare/src/pqi/p3peermgr.h index bede98560..dc20830ca 100644 --- a/libretroshare/src/pqi/p3peermgr.h +++ b/libretroshare/src/pqi/p3peermgr.h @@ -197,6 +197,7 @@ virtual bool getGpgId(const std::string &sslId, std::string &gpgId) = 0; virtual uint32_t getConnectionType(const std::string &sslId) = 0; virtual bool setProxyServerAddress(const struct sockaddr_in &proxy_addr) = 0; +virtual bool isHidden() = 0; virtual bool isHiddenPeer(const std::string &ssl_id) = 0; virtual bool getProxyAddress(const std::string &ssl_id, struct sockaddr_in &proxy_addr, std::string &domain_addr, uint16_t &domain_port) = 0; @@ -293,6 +294,7 @@ virtual bool getGpgId(const std::string &sslId, std::string &gpgId); virtual uint32_t getConnectionType(const std::string &sslId); virtual bool setProxyServerAddress(const struct sockaddr_in &proxy_addr); +virtual bool isHidden(); virtual bool isHiddenPeer(const std::string &ssl_id); virtual bool getProxyAddress(const std::string &ssl_id, struct sockaddr_in &proxy_addr, std::string &domain_addr, uint16_t &domain_port); diff --git a/libretroshare/src/pqi/pqisslproxy.cc b/libretroshare/src/pqi/pqisslproxy.cc index cfcf2ead0..5cfd391cd 100755 --- a/libretroshare/src/pqi/pqisslproxy.cc +++ b/libretroshare/src/pqi/pqisslproxy.cc @@ -40,6 +40,8 @@ const int pqisslproxyzone = 3517; +#define PROXY_DEBUG 1 + #define PROXY_STATE_FAILED 0 #define PROXY_STATE_INIT 1 #define PROXY_STATE_WAITING_METHOD_RESPONSE 2