mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-30 09:56:14 -05:00
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:
parent
99baceae7e
commit
4ef56e1b79
@ -193,6 +193,7 @@ HEADERS += dbase/cachestrapper.h \
|
||||
services/p3ranking.h \
|
||||
services/p3service.h \
|
||||
services/p3status.h \
|
||||
services/p3turtle.h \
|
||||
tcponudp/bio_tou.h \
|
||||
tcponudp/tcppacket.h \
|
||||
tcponudp/tcpstream.h \
|
||||
@ -255,6 +256,7 @@ SOURCES = \
|
||||
services/p3msgservice.cc \
|
||||
services/p3chatservice.cc \
|
||||
services/p3service.cc \
|
||||
services/p3turtle.cc \
|
||||
dbase/rsexpr.cc \
|
||||
dbase/cachestrapper.cc \
|
||||
dbase/fistore.cc \
|
||||
@ -316,12 +318,3 @@ SOURCES = \
|
||||
util/rsprint.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
|
||||
}
|
||||
|
@ -35,9 +35,7 @@ class NotifyBase;
|
||||
class RsIface;
|
||||
class RsControl;
|
||||
class RsInit;
|
||||
#ifdef TURTLE_HOPPING
|
||||
struct TurtleFileInfo ;
|
||||
#endif
|
||||
|
||||
/* 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 notifyChat() { 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; }
|
||||
#endif
|
||||
};
|
||||
|
||||
const int NOTIFY_LIST_NEIGHBOURS = 1;
|
||||
|
@ -56,9 +56,11 @@ struct TurtleFileInfo
|
||||
class RsTurtle
|
||||
{
|
||||
public:
|
||||
RsTurtle() {}
|
||||
RsTurtle() { _sharing_strategy = SHARE_ENTIRE_NETWORK ;}
|
||||
virtual ~RsTurtle() {}
|
||||
|
||||
enum FileSharingStrategy { SHARE_ENTIRE_NETWORK, SHARE_FRIENDS_ONLY } ;
|
||||
|
||||
// Lauches a search request through the pipes, and immediately returns
|
||||
// the request id, which will be further used by the gui to store results
|
||||
// as they come back.
|
||||
@ -70,6 +72,14 @@ class RsTurtle
|
||||
// initialization process.
|
||||
//
|
||||
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
|
||||
|
@ -30,16 +30,14 @@
|
||||
#include "dbase/cachestrapper.h"
|
||||
#include "ft/ftserver.h"
|
||||
#include "ft/ftcontroller.h"
|
||||
#include "rsiface/rsturtle.h"
|
||||
|
||||
/* global variable now points straight to
|
||||
* ft/ code so variable defined here.
|
||||
*/
|
||||
|
||||
RsFiles *rsFiles = NULL;
|
||||
#ifdef TURTLE_HOPPING
|
||||
#include "rsiface/rsturtle.h"
|
||||
RsTurtle *rsTurtle = NULL ;
|
||||
#endif
|
||||
|
||||
#include "pqi/pqipersongrp.h"
|
||||
#include "pqi/pqisslpersongrp.h"
|
||||
@ -63,10 +61,7 @@ RsTurtle *rsTurtle = NULL ;
|
||||
#include "services/p3channels.h"
|
||||
#include "services/p3status.h"
|
||||
#include "services/p3Qblog.h"
|
||||
|
||||
#ifdef TURTLE_HOPPING
|
||||
#include "services/p3turtle.h"
|
||||
#endif
|
||||
|
||||
#include <list>
|
||||
#include <string>
|
||||
@ -650,11 +645,10 @@ int RsServer::StartupRetroShare()
|
||||
msgSrv = new p3MsgService(mConnMgr);
|
||||
chatSrv = new p3ChatService(mConnMgr);
|
||||
|
||||
#ifdef TURTLE_HOPPING
|
||||
p3turtle *tr = new p3turtle(mConnMgr) ;
|
||||
rsTurtle = tr ;
|
||||
pqih -> addService(tr);
|
||||
#endif
|
||||
|
||||
pqih -> addService(ad);
|
||||
pqih -> addService(msgSrv);
|
||||
pqih -> addService(chatSrv);
|
||||
|
@ -198,27 +198,34 @@ void p3turtle::handleSearchRequest(RsTurtleSearchRequestItem *item)
|
||||
#ifdef P3TURTLE_DEBUG
|
||||
std::cerr << " Request not from us. Performing local search" << std::endl ;
|
||||
#endif
|
||||
std::list<TurtleFileInfo> result ;
|
||||
performLocalSearch(item->match_string,result) ;
|
||||
|
||||
if(!result.empty())
|
||||
if(_sharing_strategy != SHARE_FRIENDS_ONLY || item->depth < 2)
|
||||
{
|
||||
// do something
|
||||
std::list<TurtleFileInfo> result ;
|
||||
performLocalSearch(item->match_string,result) ;
|
||||
|
||||
// forward item back
|
||||
RsTurtleSearchResultItem *res_item = new RsTurtleSearchResultItem ;
|
||||
if(!result.empty())
|
||||
{
|
||||
// do something
|
||||
|
||||
// perhaps we should chop search results items into several items of finite size ?
|
||||
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
|
||||
// forward item back
|
||||
RsTurtleSearchResultItem *res_item = new RsTurtleSearchResultItem ;
|
||||
|
||||
// perhaps we should chop search results items into several items of finite size ?
|
||||
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
|
||||
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
|
||||
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.
|
||||
|
@ -57,6 +57,10 @@ class p3ConnectMgr;
|
||||
|
||||
const uint8_t RS_TURTLE_SUBTYPE_SEARCH_REQUEST = 0x01 ;
|
||||
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 ;
|
||||
|
||||
|
@ -35,9 +35,7 @@ class NotifyBase;
|
||||
class RsIface;
|
||||
class RsControl;
|
||||
class RsInit;
|
||||
#ifdef TURTLE_HOPPING
|
||||
struct TurtleFileInfo ;
|
||||
#endif
|
||||
|
||||
/* 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 notifyChat() { 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; }
|
||||
#endif
|
||||
};
|
||||
|
||||
const int NOTIFY_LIST_NEIGHBOURS = 1;
|
||||
|
Loading…
Reference in New Issue
Block a user