mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-02-10 03:49:51 -05:00
deep_search: use service serializer not serial_process
Avoid tricky pointers arithmetic, thanks Cyril for suggestion
This commit is contained in:
parent
c0e92ddc6b
commit
c15ae864b5
@ -206,7 +206,8 @@ void RsGenExchange::tick()
|
|||||||
|
|
||||||
if(!mIntegrityCheck)
|
if(!mIntegrityCheck)
|
||||||
{
|
{
|
||||||
mIntegrityCheck = new RsGxsIntegrityCheck(mDataStore,this,mGixs);
|
mIntegrityCheck = new RsGxsIntegrityCheck( mDataStore, this,
|
||||||
|
*mSerialiser, mGixs);
|
||||||
mIntegrityCheck->start("gxs integrity");
|
mIntegrityCheck->start("gxs integrity");
|
||||||
mChecking = true;
|
mChecking = true;
|
||||||
}
|
}
|
||||||
|
@ -149,9 +149,9 @@ bool RsGxsMessageCleanUp::clean()
|
|||||||
|
|
||||||
RsGxsIntegrityCheck::RsGxsIntegrityCheck(
|
RsGxsIntegrityCheck::RsGxsIntegrityCheck(
|
||||||
RsGeneralDataService* const dataService, RsGenExchange* genex,
|
RsGeneralDataService* const dataService, RsGenExchange* genex,
|
||||||
RsGixs* gixs ) :
|
RsSerialType& serializer, RsGixs* gixs ) :
|
||||||
mDs(dataService), mGenExchangeClient(genex), mDone(false),
|
mDs(dataService), mGenExchangeClient(genex), mSerializer(serializer),
|
||||||
mIntegrityMutex("integrity"), mGixs(gixs) {}
|
mDone(false), mIntegrityMutex("integrity"), mGixs(gixs) {}
|
||||||
|
|
||||||
void RsGxsIntegrityCheck::run()
|
void RsGxsIntegrityCheck::run()
|
||||||
{
|
{
|
||||||
@ -205,28 +205,18 @@ bool RsGxsIntegrityCheck::check()
|
|||||||
#ifdef RS_DEEP_SEARCH
|
#ifdef RS_DEEP_SEARCH
|
||||||
if(isGxsChannels)
|
if(isGxsChannels)
|
||||||
{
|
{
|
||||||
RsGxsChannelGroup cg;
|
|
||||||
RsGxsGrpMetaData meta;
|
RsGxsGrpMetaData meta;
|
||||||
|
|
||||||
meta.deserialise(grp->meta.bin_data, grp->meta.bin_len);
|
meta.deserialise(grp->meta.bin_data, grp->meta.bin_len);
|
||||||
|
|
||||||
/* TODO: Apparently a copy of the pointer to
|
uint32_t blz = grp->grp.bin_len;
|
||||||
* grp.bin_data is stored into grp.bin_data thus
|
RsItem* rIt = mSerializer.deserialise(grp->grp.bin_data,
|
||||||
* breaking the deserialization, skipping the pointer
|
&blz);
|
||||||
* (8 bytes on x86_64 debug build) fix the
|
|
||||||
* deserilization, talk to Cyril how to properly fix
|
|
||||||
* this.*/
|
|
||||||
RsGenericSerializer::SerializeContext ctx(
|
|
||||||
static_cast<uint8_t*>(grp->grp.bin_data)+8,
|
|
||||||
grp->grp.bin_len-8 );
|
|
||||||
|
|
||||||
RsGxsChannelGroupItem cgIt;
|
if( RsGxsChannelGroupItem* cgIt =
|
||||||
cgIt.serial_process( RsGenericSerializer::DESERIALIZE,
|
dynamic_cast<RsGxsChannelGroupItem*>(rIt) )
|
||||||
ctx );
|
|
||||||
|
|
||||||
if(ctx.mOk)
|
|
||||||
{
|
{
|
||||||
cgIt.toChannelGroup(cg, false);
|
RsGxsChannelGroup cg;
|
||||||
|
cgIt->toChannelGroup(cg, false);
|
||||||
cg.mMeta = meta;
|
cg.mMeta = meta;
|
||||||
|
|
||||||
DeepSearch::indexChannelGroup(cg);
|
DeepSearch::indexChannelGroup(cg);
|
||||||
@ -239,12 +229,14 @@ bool RsGxsIntegrityCheck::check()
|
|||||||
std::cout << __PRETTY_FUNCTION__ << " ||Group: "
|
std::cout << __PRETTY_FUNCTION__ << " ||Group: "
|
||||||
<< meta.mGroupName
|
<< meta.mGroupName
|
||||||
<< " ||doesn't seems a channel"
|
<< " ||doesn't seems a channel"
|
||||||
<< " ||ctx.mOk: " << ctx.mOk
|
<< " ||grp->grp.bin_data: "
|
||||||
<< " ||ctx.mData: " << (void*)ctx.mData
|
<< grp->grp.bin_data
|
||||||
<< " ||ctx.mSize: " << ctx.mSize
|
<< " ||grp->grp.bin_len: "
|
||||||
<< " ||grp->grp.bin_data: " << grp->grp.bin_data
|
<< grp->grp.bin_len
|
||||||
<< " ||grp->grp.bin_len: " << grp->grp.bin_len
|
<< " ||rIt: " << rIt << " ||blz: " << blz
|
||||||
<< std::endl;
|
<< " ||cgIt: " << cgIt << std::endl;
|
||||||
|
|
||||||
|
delete rIt;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -201,7 +201,9 @@ public:
|
|||||||
* @param chunkSize
|
* @param chunkSize
|
||||||
* @param sleepPeriod
|
* @param sleepPeriod
|
||||||
*/
|
*/
|
||||||
RsGxsIntegrityCheck(RsGeneralDataService* const dataService, RsGenExchange *genex, RsGixs *gixs);
|
RsGxsIntegrityCheck( RsGeneralDataService* const dataService,
|
||||||
|
RsGenExchange *genex, RsSerialType& gxsSerialiser,
|
||||||
|
RsGixs *gixs);
|
||||||
|
|
||||||
bool check();
|
bool check();
|
||||||
bool isDone();
|
bool isDone();
|
||||||
@ -214,12 +216,14 @@ private:
|
|||||||
|
|
||||||
RsGeneralDataService* const mDs;
|
RsGeneralDataService* const mDs;
|
||||||
RsGenExchange *mGenExchangeClient;
|
RsGenExchange *mGenExchangeClient;
|
||||||
|
RsSerialType& mSerializer;
|
||||||
|
|
||||||
bool mDone;
|
bool mDone;
|
||||||
RsMutex mIntegrityMutex;
|
RsMutex mIntegrityMutex;
|
||||||
std::list<RsGxsGroupId> mDeletedGrps;
|
std::list<RsGxsGroupId> mDeletedGrps;
|
||||||
std::map<RsGxsGroupId, std::set<RsGxsMessageId> > mDeletedMsgs;
|
std::map<RsGxsGroupId, std::set<RsGxsMessageId> > mDeletedMsgs;
|
||||||
|
|
||||||
RsGixs *mGixs ;
|
RsGixs* mGixs;
|
||||||
};
|
};
|
||||||
|
|
||||||
class GroupUpdate
|
class GroupUpdate
|
||||||
|
Loading…
x
Reference in New Issue
Block a user