added some more debug info and proper error output to GxsDb

This commit is contained in:
csoler 2020-03-26 23:19:34 +01:00
parent 8cf78b072b
commit c18dfb39c3
No known key found for this signature in database
GPG key ID: 7BCA522266C0804C
8 changed files with 98 additions and 46 deletions

View file

@ -110,6 +110,12 @@ struct RsGxsChanges : RsEvent
*/
struct RsGxsIface
{
/*!
* \brief serviceType
* \return The 16-bits service type. See @serialiser/rsserviceids.h
*/
virtual uint16_t serviceType() const =0;
/*!
* Gxs services should call this for automatic handling of
* changes, send

View file

@ -26,6 +26,7 @@
#include <thread>
#include "retroshare/rsgxsiface.h"
#include "retroshare/rsservicecontrol.h"
#include "retroshare/rsreputations.h"
#include "rsgxsflags.h"
#include "util/rsdeprecate.h"
@ -454,9 +455,19 @@ private:
void locked_dumpTokens()
{
std::cerr << "Active tokens (this=" << (void*)this << "): " ;
for(auto it: mActiveTokens)
std::cerr << std::dec << it.first << " (" << static_cast<int>(it.second) << ") " ;
uint16_t service_id = mGxs.serviceType();
uint32_t count[7] = {0};
std::cerr << "Service 0x0" << std::hex << service_id
<< " (" << rsServiceControl->getServiceName(RsServiceInfo::RsServiceInfoUIn16ToFullServiceId(service_id))
<< ") this=0x" << (void*)this << ") Active tokens (per type): " ;
for(auto& it: mActiveTokens) // let's count how many token of each type we've got.
++count[static_cast<int>(it.second)];
for(uint32_t i=0;i<7;++i)
std::cerr /* << i << ":" */ << count[i] << " ";
std::cerr << std::endl;
}
};