Merge branch 'csoler/v0.6-FT' into jsonapi

Needed to exopse JSON API for file search
This commit is contained in:
Gioacchino Mazzurco 2018-08-25 16:14:42 +02:00
commit 31f0a42b86
No known key found for this signature in database
GPG Key ID: A1FBCA3872E87051
3 changed files with 18 additions and 2 deletions

View File

@ -1820,6 +1820,13 @@ int ftServer::handleIncoming()
********************************** **********************************
*********************************/ *********************************/
void ftServer::receiveSearchResult(RsTurtleFTSearchResultItem *item)
{
// @Gio: add your thing here
RsServer::notify()->notifyTurtleSearchResult(item->request_id,item->result) ;
}
/***************************** CONFIG ****************************/ /***************************** CONFIG ****************************/
bool ftServer::addConfiguration(p3ConfigMgr *cfgmgr) bool ftServer::addConfiguration(p3ConfigMgr *cfgmgr)

View File

@ -96,7 +96,7 @@ public:
uint16_t serviceId() const { return RS_SERVICE_TYPE_FILE_TRANSFER ; } uint16_t serviceId() const { return RS_SERVICE_TYPE_FILE_TRANSFER ; }
virtual bool handleTunnelRequest(const RsFileHash& hash,const RsPeerId& peer_id) ; virtual bool handleTunnelRequest(const RsFileHash& hash,const RsPeerId& peer_id) ;
virtual void receiveTurtleData(const RsTurtleGenericTunnelItem *item,const RsFileHash& hash,const RsPeerId& virtual_peer_id,RsTurtleGenericTunnelItem::Direction direction) ; virtual void receiveTurtleData(const RsTurtleGenericTunnelItem *item,const RsFileHash& hash,const RsPeerId& virtual_peer_id,RsTurtleGenericTunnelItem::Direction direction) ;
//virtual void receiveSearchResult(RsTurtleSearchResultItem *item);// TODO virtual void receiveSearchResult(RsTurtleFTSearchResultItem *item);
virtual RsItem *create_item(uint16_t service,uint8_t item_type) const ; virtual RsItem *create_item(uint16_t service,uint8_t item_type) const ;
virtual RsServiceSerializer *serializer() { return this ; } virtual RsServiceSerializer *serializer() { return this ; }

View File

@ -1191,7 +1191,16 @@ void p3turtle::handleSearchResult(RsTurtleSearchResultItem *item)
if(ftsr!=NULL) if(ftsr!=NULL)
{ {
RsServer::notify()->notifyTurtleSearchResult(ftsr->request_id,ftsr->result) ; ftServer *client = dynamic_cast<ftServer*>((*it).second) ;
if(!client)
{
std::cerr << "(EE) received turtle FT search result but the service is not a ftServer!!" << std::endl;
continue;
}
//RsServer::notify()->notifyTurtleSearchResult(ftsr->request_id,ftsr->result) ;
client->receiveSearchResult(ftsr);
continue ; continue ;
} }