From 2805d4ca1e20fb34544b39562a3fdf10bb6c099c Mon Sep 17 00:00:00 2001 From: csoler Date: Sat, 14 Jan 2012 13:27:48 +0000 Subject: [PATCH] disabled turtle routing for relayed connexions git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@4799 b45a01b8-16f6-495d-af2f-9b41ad6348cc --- libretroshare/src/turtle/p3turtle.cc | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/libretroshare/src/turtle/p3turtle.cc b/libretroshare/src/turtle/p3turtle.cc index 79f5a7970..1df738a29 100644 --- a/libretroshare/src/turtle/p3turtle.cc +++ b/libretroshare/src/turtle/p3turtle.cc @@ -36,6 +36,7 @@ #include "pqi/authssl.h" #include "pqi/p3linkmgr.h" +#include "retroshare/rspeers.h" #include "pqi/pqinotify.h" #include "ft/ftserver.h" @@ -807,6 +808,12 @@ void p3turtle::handleSearchRequest(RsTurtleSearchRequestItem *item) #endif for(std::list::const_iterator it(onlineIds.begin());it!=onlineIds.end();++it) + { + uint32_t linkType = mLinkMgr->getLinkType(*it); + + if ((linkType & RS_NET_CONN_SPEED_TRICKLE) || (linkType & RS_NET_CONN_SPEED_LOW)) // don't forward searches to slow link types (e.g relay peers)! + continue ; + if(*it != item->PeerId()) { #ifdef P3TURTLE_DEBUG @@ -828,6 +835,7 @@ void p3turtle::handleSearchRequest(RsTurtleSearchRequestItem *item) sendItem(fwd_item) ; } + } } #ifdef P3TURTLE_DEBUG else @@ -1732,6 +1740,12 @@ void p3turtle::handleTunnelRequest(RsTurtleOpenTunnelItem *item) #endif for(std::list::const_iterator it(onlineIds.begin());it!=onlineIds.end();++it) + { + uint32_t linkType = mLinkMgr->getLinkType(*it); + + if ((linkType & RS_NET_CONN_SPEED_TRICKLE) || (linkType & RS_NET_CONN_SPEED_LOW)) // don't forward tunnel requests to slow link types (e.g relay peers)! + continue ; + if(*it != item->PeerId() && RSRandom::random_f32() <= forward_probability) { #ifdef P3TURTLE_DEBUG @@ -1758,6 +1772,7 @@ void p3turtle::handleTunnelRequest(RsTurtleOpenTunnelItem *item) sendItem(fwd_item) ; } + } } #ifdef P3TURTLE_DEBUG else