fixed bug in recent commit that broke turtle generic search

This commit is contained in:
csoler 2018-10-13 22:59:26 +02:00
parent 9c90b32def
commit 74022a5e10
No known key found for this signature in database
GPG Key ID: 7BCA522266C0804C
2 changed files with 9 additions and 12 deletions

View File

@ -26,9 +26,6 @@
#include <stdexcept>
#include <stdlib.h>
#include <assert.h>
#ifdef P3TURTLE_DEBUG
#include <assert.h>
#endif
#include "rsserver/p3face.h"
#include "crypto/rscrypto.h"
@ -930,6 +927,9 @@ void p3turtle::handleSearchRequest(RsTurtleSearchRequestItem *item)
(*it)->request_id = item->request_id ;
(*it)->PeerId(item->PeerId()) ;
#ifdef P3TURTLE_DEBUG
std::cerr << " sending back search result for request " << item->request_id << " to back to peer " << item->PeerId() << std::endl ;
#endif
sendItem(*it) ;
}
}
@ -1174,7 +1174,8 @@ void p3turtle::handleSearchResult(RsTurtleSearchResultItem *item)
if(it->second.result_count >= it->second.max_allowed_hits)
{
std::cerr << "(WW) exceeded turtle search result to forward. Req=" << std::hex << item->request_id << std::dec << ": dropping item with " << n << " elements." << std::endl;
std::cerr << "(WW) exceeded turtle search result to forward. Req=" << std::hex << item->request_id << std::dec
<< " already forwarded: " << it->second.result_count << ", max_allowed: " << it->second.max_allowed_hits << ": dropping item with " << n << " elements." << std::endl;
return ;
}
@ -2099,7 +2100,7 @@ void p3turtle::monitorTunnels(const RsFileHash& hash,RsTurtleClientService *clie
if(_hashes_to_remove.erase(hash) > 0)
{
#ifdef P3TURTLE_DEBUG
std::cerr << "p3turtle: File hash " << hash << " Was scheduled for removal. Canceling the removal." << std::endl ;
TURTLE_DEBUG() << "p3turtle: File hash " << hash << " Was scheduled for removal. Canceling the removal." << std::endl ;
#endif
}
@ -2108,12 +2109,12 @@ void p3turtle::monitorTunnels(const RsFileHash& hash,RsTurtleClientService *clie
if(_incoming_file_hashes.find(hash) != _incoming_file_hashes.end()) // download already asked.
{
#ifdef P3TURTLE_DEBUG
std::cerr << "p3turtle: File hash " << hash << " already in pool. Returning." << std::endl ;
TURTLE_DEBUG() << "p3turtle: File hash " << hash << " already in pool. Returning." << std::endl ;
#endif
return ;
}
#ifdef P3TURTLE_DEBUG
std::cerr << "p3turtle: Received order for turtle download fo hash " << hash << std::endl ;
TURTLE_DEBUG() << "p3turtle: Received order for turtle download fo hash " << hash << std::endl ;
#endif
// No tunnels at start, but this triggers digging new tunnels.
@ -2129,10 +2130,6 @@ void p3turtle::monitorTunnels(const RsFileHash& hash,RsTurtleClientService *clie
IndicateConfigChanged() ; // initiates saving of handled hashes.
}
#ifdef P3TURTLE_DEBUG
std::cerr << " Returning result for search request " << HEX_PRINT(item->request_id) << " upwards." << std::endl ;
#endif
// RsTurtleGxsSearchResultGroupSummaryItem *gxs_sr_gs = dynamic_cast<RsTurtleGxsSearchResultGroupSummaryItem*>(item) ;
//

View File

@ -104,7 +104,7 @@ RsTurtleSearchRequestItem *RsTurtleGenericSearchRequestItem::clone() const
}
RsTurtleGenericSearchRequestItem::RsTurtleGenericSearchRequestItem(const RsTurtleGenericSearchRequestItem& it)
: RsTurtleSearchRequestItem(RS_TURTLE_SUBTYPE_GENERIC_SEARCH_REQUEST)
: RsTurtleSearchRequestItem(it)
{
search_data_len = it.search_data_len ;
search_data = (unsigned char*)rs_malloc(it.search_data_len) ;