From 99519f14bd4741129e827b1296a8ab857ab6e926 Mon Sep 17 00:00:00 2001 From: chrisparker126 Date: Sat, 19 Jul 2014 08:29:56 +0000 Subject: [PATCH] last bit needed have statistic functions - getgrpstatistic and getservicestatistic should be working now git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@7458 b45a01b8-16f6-495d-af2f-9b41ad6348cc --- libretroshare/src/gxs/rsgxsdataaccess.cc | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/libretroshare/src/gxs/rsgxsdataaccess.cc b/libretroshare/src/gxs/rsgxsdataaccess.cc index 517be721a..e9ece5f40 100644 --- a/libretroshare/src/gxs/rsgxsdataaccess.cc +++ b/libretroshare/src/gxs/rsgxsdataaccess.cc @@ -724,7 +724,9 @@ void RsGxsDataAccess::processRequests() MsgMetaReq* mmr; MsgDataReq* mdr; MsgIdReq* mir; - MsgRelatedInfoReq* mri; + MsgRelatedInfoReq* mri; + GroupStatisticRequest* gsr; + ServiceStatisticRequest* ssr; for(it = mRequests.begin(); it != mRequests.end(); it++) { @@ -766,10 +768,18 @@ void RsGxsDataAccess::processRequests() { getMsgList(mir); } - else if((mri = dynamic_cast(req)) != NULL) - { - getMsgRelatedInfo(mri); - } + else if((mri = dynamic_cast(req)) != NULL) + { + getMsgRelatedInfo(mri); + } + else if((gsr = dynamic_cast(req)) != NULL) + { + getGroupStatistic(gsr); + } + else if((ssr = dynamic_cast(req)) != NULL) + { + getServiceStatistic(ssr); + } else { std::cerr << "RsGxsDataAccess::processRequests() Failed to process request, token: " @@ -1452,6 +1462,8 @@ bool RsGxsDataAccess::getGroupStatistic(GroupStatisticRequest *req) RsGxsMsgMetaData* m = msgMetaV[i]; req->mGroupStatistic.mTotalSizeOfMsgs += m->mMsgSize + m->serial_size(); } + + cleanseMsgMetaMap(metaResult); return true; } @@ -1477,6 +1489,7 @@ bool RsGxsDataAccess::getServiceStatistic(ServiceStatisticRequest *req) getGroupStatistic(&gr); req->mServiceStatistic.mNumMsgs += gr.mGroupStatistic.mNumMsgs; req->mServiceStatistic.mSizeOfMsgs += gr.mGroupStatistic.mTotalSizeOfMsgs; + delete m; } req->mServiceStatistic.mSizeStore = req->mServiceStatistic.mSizeOfGrps + req->mServiceStatistic.mSizeOfMsgs;