diff --git a/libretroshare/src/turtle/p3turtle.cc b/libretroshare/src/turtle/p3turtle.cc index c14b46e6c..c422b2dc0 100644 --- a/libretroshare/src/turtle/p3turtle.cc +++ b/libretroshare/src/turtle/p3turtle.cc @@ -928,7 +928,6 @@ void p3turtle::handleSearchRequest(RsTurtleSearchRequestItem *item) for(auto it(search_results.begin());it!=search_results.end();++it) { (*it)->request_id = item->request_id ; - (*it)->depth = 0 ; (*it)->PeerId(item->PeerId()) ; sendItem(*it) ; @@ -1174,7 +1173,6 @@ void p3turtle::handleSearchResult(RsTurtleSearchResultItem *item) // of the files found can be further reached by a tunnel. fwd_item->PeerId(it->second.origin) ; - fwd_item->depth = 0 ; // obfuscate the depth for non immediate friends. Result will always be 0. This effectively removes the information. sendItem(fwd_item) ; } diff --git a/libretroshare/src/turtle/rsturtleitem.cc b/libretroshare/src/turtle/rsturtleitem.cc index 3c51f7c29..38ab3bb23 100644 --- a/libretroshare/src/turtle/rsturtleitem.cc +++ b/libretroshare/src/turtle/rsturtleitem.cc @@ -193,13 +193,20 @@ RS_TYPE_SERIALIZER_FROM_JSON_NOT_IMPLEMENTED_DEF(RsRegularExpression::Linearized void RsTurtleFTSearchResultItem::serial_process(RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx) { RsTypeSerializer::serial_process(j,ctx,request_id,"request_id") ; - RsTypeSerializer::serial_process(j,ctx,depth ,"depth") ; + + // This depth was previously a member of SearchResult parent class that was set to be always 0. It's removed, but we have to stay backward compatible. + uint16_t depth_retrocompat_unused_placeholder = 0 ; + RsTypeSerializer::serial_process(j,ctx,depth_retrocompat_unused_placeholder,"depth") ; + RsTypeSerializer::serial_process (j,ctx,result ,"result") ; } void RsTurtleGenericSearchResultItem::serial_process(RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx) { RsTypeSerializer::serial_process(j,ctx,request_id,"request_id") ; - RsTypeSerializer::serial_process(j,ctx,depth ,"depth") ; + + // This depth was previously a member of SearchResult parent class that was set to be always 0. It's removed, but we have to stay backward compatible. + uint16_t depth_retrocompat_unused_placeholder = 0 ; + RsTypeSerializer::serial_process(j,ctx,depth_retrocompat_unused_placeholder,"depth") ; RsTypeSerializer::TlvMemBlock_proxy prox(result_data,result_data_len) ; RsTypeSerializer::serial_process(j,ctx,prox,"search_data") ; @@ -212,7 +219,6 @@ RsTurtleSearchResultItem *RsTurtleGenericSearchResultItem::duplicate() const memcpy(sr->result_data,result_data,result_data_len) ; sr->result_data_len = result_data_len ; sr->request_id = request_id ; - sr->depth = depth ; return sr ; } diff --git a/libretroshare/src/turtle/rsturtleitem.h b/libretroshare/src/turtle/rsturtleitem.h index 9643089b8..1f4893087 100644 --- a/libretroshare/src/turtle/rsturtleitem.h +++ b/libretroshare/src/turtle/rsturtleitem.h @@ -191,12 +191,9 @@ class RsTurtleGenericSearchRequestItem: public RsTurtleSearchRequestItem class RsTurtleSearchResultItem: public RsTurtleItem { public: - RsTurtleSearchResultItem(uint8_t subtype) : RsTurtleItem(subtype), request_id(0), depth(0) { setPriorityLevel(QOS_PRIORITY_RS_TURTLE_SEARCH_RESULT) ;} + RsTurtleSearchResultItem(uint8_t subtype) : RsTurtleItem(subtype), request_id(0) { setPriorityLevel(QOS_PRIORITY_RS_TURTLE_SEARCH_RESULT) ;} TurtleSearchRequestId request_id ; // Randomly generated request id. - uint16_t depth ; // The depth of a search result is obfuscated in this way: - // If the actual depth is 1, this field will be 1. - // If the actual depth is > 1, this field is a larger arbitrary integer. virtual uint32_t count() const =0; virtual void pop() =0;