suppressed #ifdef TURTLE_HOPPING from libretroshare, as it s not anymore needed.

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@1094 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
csoler 2009-03-22 14:08:02 +00:00
parent 99baceae7e
commit 4ef56e1b79
7 changed files with 40 additions and 40 deletions

View file

@ -193,6 +193,7 @@ HEADERS += dbase/cachestrapper.h \
services/p3ranking.h \ services/p3ranking.h \
services/p3service.h \ services/p3service.h \
services/p3status.h \ services/p3status.h \
services/p3turtle.h \
tcponudp/bio_tou.h \ tcponudp/bio_tou.h \
tcponudp/tcppacket.h \ tcponudp/tcppacket.h \
tcponudp/tcpstream.h \ tcponudp/tcpstream.h \
@ -255,6 +256,7 @@ SOURCES = \
services/p3msgservice.cc \ services/p3msgservice.cc \
services/p3chatservice.cc \ services/p3chatservice.cc \
services/p3service.cc \ services/p3service.cc \
services/p3turtle.cc \
dbase/rsexpr.cc \ dbase/rsexpr.cc \
dbase/cachestrapper.cc \ dbase/cachestrapper.cc \
dbase/fistore.cc \ dbase/fistore.cc \
@ -316,12 +318,3 @@ SOURCES = \
util/rsprint.cc \ util/rsprint.cc \
util/rsthreads.cc util/rsthreads.cc
# To compile for turtle hopping. I'm using this flag to avoid conflict while developping.
# Just do a
# qmake CONFIG=turtle
turtle {
SOURCES += services/p3turtle.cc
HEADERS += services/p3turtle.h
DEFINES *= TURTLE_HOPPING
}

View file

@ -35,9 +35,7 @@ class NotifyBase;
class RsIface; class RsIface;
class RsControl; class RsControl;
class RsInit; class RsInit;
#ifdef TURTLE_HOPPING
struct TurtleFileInfo ; struct TurtleFileInfo ;
#endif
/* declare single RsIface for everyone to use! */ /* declare single RsIface for everyone to use! */
@ -203,9 +201,7 @@ class NotifyBase
virtual void notifyErrorMsg(int list, int sev, std::string msg) { (void) list; (void) sev; (void) msg; return; } virtual void notifyErrorMsg(int list, int sev, std::string msg) { (void) list; (void) sev; (void) msg; return; }
virtual void notifyChat() { return; } virtual void notifyChat() { return; }
virtual void notifyHashingInfo(std::string fileinfo) { (void)fileinfo; return ; } virtual void notifyHashingInfo(std::string fileinfo) { (void)fileinfo; return ; }
#ifdef TURTLE_HOPPING
virtual void notifyTurtleSearchResult(uint32_t search_id,const std::list<TurtleFileInfo>& files) { (void)files; } virtual void notifyTurtleSearchResult(uint32_t search_id,const std::list<TurtleFileInfo>& files) { (void)files; }
#endif
}; };
const int NOTIFY_LIST_NEIGHBOURS = 1; const int NOTIFY_LIST_NEIGHBOURS = 1;

View file

@ -56,9 +56,11 @@ struct TurtleFileInfo
class RsTurtle class RsTurtle
{ {
public: public:
RsTurtle() {} RsTurtle() { _sharing_strategy = SHARE_ENTIRE_NETWORK ;}
virtual ~RsTurtle() {} virtual ~RsTurtle() {}
enum FileSharingStrategy { SHARE_ENTIRE_NETWORK, SHARE_FRIENDS_ONLY } ;
// Lauches a search request through the pipes, and immediately returns // Lauches a search request through the pipes, and immediately returns
// the request id, which will be further used by the gui to store results // the request id, which will be further used by the gui to store results
// as they come back. // as they come back.
@ -70,6 +72,14 @@ class RsTurtle
// initialization process. // initialization process.
// //
virtual void turtleDownload(const std::string& file_hash) = 0 ; virtual void turtleDownload(const std::string& file_hash) = 0 ;
// Sets the file sharing strategy. It concerns all local files. It would
// be better to handle this for each file, of course.
void setFileSharingStrategy(FileSharingStrategy f) { _sharing_strategy = f ; }
protected:
FileSharingStrategy _sharing_strategy ;
}; };
#endif #endif

View file

@ -30,16 +30,14 @@
#include "dbase/cachestrapper.h" #include "dbase/cachestrapper.h"
#include "ft/ftserver.h" #include "ft/ftserver.h"
#include "ft/ftcontroller.h" #include "ft/ftcontroller.h"
#include "rsiface/rsturtle.h"
/* global variable now points straight to /* global variable now points straight to
* ft/ code so variable defined here. * ft/ code so variable defined here.
*/ */
RsFiles *rsFiles = NULL; RsFiles *rsFiles = NULL;
#ifdef TURTLE_HOPPING
#include "rsiface/rsturtle.h"
RsTurtle *rsTurtle = NULL ; RsTurtle *rsTurtle = NULL ;
#endif
#include "pqi/pqipersongrp.h" #include "pqi/pqipersongrp.h"
#include "pqi/pqisslpersongrp.h" #include "pqi/pqisslpersongrp.h"
@ -63,10 +61,7 @@ RsTurtle *rsTurtle = NULL ;
#include "services/p3channels.h" #include "services/p3channels.h"
#include "services/p3status.h" #include "services/p3status.h"
#include "services/p3Qblog.h" #include "services/p3Qblog.h"
#ifdef TURTLE_HOPPING
#include "services/p3turtle.h" #include "services/p3turtle.h"
#endif
#include <list> #include <list>
#include <string> #include <string>
@ -650,11 +645,10 @@ int RsServer::StartupRetroShare()
msgSrv = new p3MsgService(mConnMgr); msgSrv = new p3MsgService(mConnMgr);
chatSrv = new p3ChatService(mConnMgr); chatSrv = new p3ChatService(mConnMgr);
#ifdef TURTLE_HOPPING
p3turtle *tr = new p3turtle(mConnMgr) ; p3turtle *tr = new p3turtle(mConnMgr) ;
rsTurtle = tr ; rsTurtle = tr ;
pqih -> addService(tr); pqih -> addService(tr);
#endif
pqih -> addService(ad); pqih -> addService(ad);
pqih -> addService(msgSrv); pqih -> addService(msgSrv);
pqih -> addService(chatSrv); pqih -> addService(chatSrv);

View file

@ -198,27 +198,34 @@ void p3turtle::handleSearchRequest(RsTurtleSearchRequestItem *item)
#ifdef P3TURTLE_DEBUG #ifdef P3TURTLE_DEBUG
std::cerr << " Request not from us. Performing local search" << std::endl ; std::cerr << " Request not from us. Performing local search" << std::endl ;
#endif #endif
std::list<TurtleFileInfo> result ; if(_sharing_strategy != SHARE_FRIENDS_ONLY || item->depth < 2)
performLocalSearch(item->match_string,result) ;
if(!result.empty())
{ {
// do something std::list<TurtleFileInfo> result ;
performLocalSearch(item->match_string,result) ;
// forward item back if(!result.empty())
RsTurtleSearchResultItem *res_item = new RsTurtleSearchResultItem ; {
// do something
// perhaps we should chop search results items into several items of finite size ? // forward item back
res_item->depth = 0 ; RsTurtleSearchResultItem *res_item = new RsTurtleSearchResultItem ;
res_item->result = result ;
res_item->request_id = item->request_id ; // perhaps we should chop search results items into several items of finite size ?
res_item->PeerId(item->PeerId()) ; // send back to the same guy res_item->depth = 0 ;
res_item->result = result ;
res_item->request_id = item->request_id ;
res_item->PeerId(item->PeerId()) ; // send back to the same guy
#ifdef P3TURTLE_DEBUG #ifdef P3TURTLE_DEBUG
std::cerr << " " << result.size() << " matches found. Sending back to origin (" << res_item->PeerId() << ")." << std::endl ; std::cerr << " " << result.size() << " matches found. Sending back to origin (" << res_item->PeerId() << ")." << std::endl ;
#endif #endif
sendItem(res_item) ; sendItem(res_item) ;
}
} }
#ifdef P3TURTLE_DEBUG
else
std::cerr << " Rejecting local search because strategy is FRIENDS_ONLY and item depth=" << item->depth << std::endl ;
#endif
} }
// If search depth not too large, also forward this search request to all other peers. // If search depth not too large, also forward this search request to all other peers.

View file

@ -57,6 +57,10 @@ class p3ConnectMgr;
const uint8_t RS_TURTLE_SUBTYPE_SEARCH_REQUEST = 0x01 ; const uint8_t RS_TURTLE_SUBTYPE_SEARCH_REQUEST = 0x01 ;
const uint8_t RS_TURTLE_SUBTYPE_SEARCH_RESULT = 0x02 ; const uint8_t RS_TURTLE_SUBTYPE_SEARCH_RESULT = 0x02 ;
const uint8_t RS_TURTLE_SUBTYPE_OPEN_TUNNEL = 0x03 ;
const uint8_t RS_TURTLE_SUBTYPE_TUNNEL_OK = 0x04 ;
const uint8_t RS_TURTLE_SUBTYPE_CLOSE_TUNNEL = 0x05 ;
const uint8_t RS_TURTLE_SUBTYPE_TUNNEL_CLOSED = 0x06 ;
static const int TURTLE_MAX_SEARCH_DEPTH = 6 ; static const int TURTLE_MAX_SEARCH_DEPTH = 6 ;

View file

@ -35,9 +35,7 @@ class NotifyBase;
class RsIface; class RsIface;
class RsControl; class RsControl;
class RsInit; class RsInit;
#ifdef TURTLE_HOPPING
struct TurtleFileInfo ; struct TurtleFileInfo ;
#endif
/* declare single RsIface for everyone to use! */ /* declare single RsIface for everyone to use! */
@ -203,9 +201,7 @@ class NotifyBase
virtual void notifyErrorMsg(int list, int sev, std::string msg) { (void) list; (void) sev; (void) msg; return; } virtual void notifyErrorMsg(int list, int sev, std::string msg) { (void) list; (void) sev; (void) msg; return; }
virtual void notifyChat() { return; } virtual void notifyChat() { return; }
virtual void notifyHashingInfo(std::string fileinfo) { (void)fileinfo; return ; } virtual void notifyHashingInfo(std::string fileinfo) { (void)fileinfo; return ; }
#ifdef TURTLE_HOPPING
virtual void notifyTurtleSearchResult(uint32_t search_id,const std::list<TurtleFileInfo>& files) { (void)files; } virtual void notifyTurtleSearchResult(uint32_t search_id,const std::list<TurtleFileInfo>& files) { (void)files; }
#endif
}; };
const int NOTIFY_LIST_NEIGHBOURS = 1; const int NOTIFY_LIST_NEIGHBOURS = 1;