added additional debug info to test proper distant request of GXS ids

This commit is contained in:
csoler 2018-05-01 15:17:41 +02:00
parent c5ba0e975f
commit ba0819f8d0
No known key found for this signature in database
GPG key ID: 7BCA522266C0804C
3 changed files with 22 additions and 8 deletions

View file

@ -273,14 +273,14 @@
***/ ***/
#define NXS_NET_DEBUG_0 1 #define NXS_NET_DEBUG_0 1
//#define NXS_NET_DEBUG_1 1 #define NXS_NET_DEBUG_1 1
//#define NXS_NET_DEBUG_2 1 //#define NXS_NET_DEBUG_2 1
//#define NXS_NET_DEBUG_3 1 //#define NXS_NET_DEBUG_3 1
//#define NXS_NET_DEBUG_4 1 //#define NXS_NET_DEBUG_4 1
//#define NXS_NET_DEBUG_5 1 #define NXS_NET_DEBUG_5 1
//#define NXS_NET_DEBUG_6 1 //#define NXS_NET_DEBUG_6 1
//#define NXS_NET_DEBUG_7 1 //#define NXS_NET_DEBUG_7 1
//#define NXS_NET_DEBUG_8 1 #define NXS_NET_DEBUG_8 1
//#define NXS_FRAG //#define NXS_FRAG
@ -318,7 +318,7 @@ static const uint32_t RS_NXS_ITEM_ENCRYPTION_STATUS_GXS_KEY_MISSING = 0x05 ;
|| defined(NXS_NET_DEBUG_8) || defined(NXS_NET_DEBUG_8)
static const RsPeerId peer_to_print = RsPeerId(std::string("")) ; static const RsPeerId peer_to_print = RsPeerId(std::string("")) ;
static const RsGxsGroupId group_id_to_print = RsGxsGroupId(std::string("ff8d59ef38cad0429f34cc21749dda71")) ; // use this to allow to this group id only, or "" for all IDs static const RsGxsGroupId group_id_to_print = RsGxsGroupId(std::string("")) ; // use this to allow to this group id only, or "" for all IDs
static const uint32_t service_to_print = RS_SERVICE_GXS_TYPE_CHANNELS ; // use this to allow to this service id only, or 0 for all services static const uint32_t service_to_print = RS_SERVICE_GXS_TYPE_CHANNELS ; // use this to allow to this service id only, or 0 for all services
// warning. Numbers should be SERVICE IDS (see serialiser/rsserviceids.h. E.g. 0x0215 for forums) // warning. Numbers should be SERVICE IDS (see serialiser/rsserviceids.h. E.g. 0x0215 for forums)
@ -3275,7 +3275,7 @@ void RsGxsNetService::locked_genSendGrpsTransaction(NxsTransaction* tr)
{ {
#ifdef NXS_NET_DEBUG_1 #ifdef NXS_NET_DEBUG_1
GXSNETDEBUG_P_(tr->mTransaction->PeerId()) << "locked_genSendGrpsTransaction() Generating Grp data send fron TransN: " << tr->mTransaction->transactionNumber << std::endl; GXSNETDEBUG_P_(tr->mTransaction->PeerId()) << "locked_genSendGrpsTransaction() Generating Grp data send from TransN: " << tr->mTransaction->transactionNumber << std::endl;
#endif #endif
// go groups requested in transaction tr // go groups requested in transaction tr
@ -3288,7 +3288,12 @@ void RsGxsNetService::locked_genSendGrpsTransaction(NxsTransaction* tr)
{ {
RsNxsSyncGrpItem* item = dynamic_cast<RsNxsSyncGrpItem*>(*lit); RsNxsSyncGrpItem* item = dynamic_cast<RsNxsSyncGrpItem*>(*lit);
if (item) if (item)
{
#ifdef NXS_NET_DEBUG_1
GXSNETDEBUG_PG(tr->mTransaction->PeerId(),item->grpId) << "locked_genSendGrpsTransaction() retrieving data for group \"" << item->grpId << "\"" << std::endl;
#endif
grps[item->grpId] = NULL; grps[item->grpId] = NULL;
}
else else
{ {
#ifdef NXS_NET_DEBUG_1 #ifdef NXS_NET_DEBUG_1
@ -3300,7 +3305,12 @@ void RsGxsNetService::locked_genSendGrpsTransaction(NxsTransaction* tr)
if(!grps.empty()) if(!grps.empty())
mDataStore->retrieveNxsGrps(grps, false, false); mDataStore->retrieveNxsGrps(grps, false, false);
else else
{
#ifdef NXS_NET_DEBUG_1
GXSNETDEBUG_P_(tr->mTransaction->PeerId()) << "RsGxsNetService::locked_genSendGrpsTransaction(): no group to request! This is unexpected" << std::endl;
#endif
return; return;
}
NxsTransaction* newTr = new NxsTransaction(); NxsTransaction* newTr = new NxsTransaction();
newTr->mFlag = NxsTransaction::FLAG_STATE_WAITING_CONFIRM; newTr->mFlag = NxsTransaction::FLAG_STATE_WAITING_CONFIRM;
@ -3317,6 +3327,9 @@ void RsGxsNetService::locked_genSendGrpsTransaction(NxsTransaction* tr)
mit->second->transactionNumber = transN; mit->second->transactionNumber = transN;
newTr->mItems.push_back(mit->second); newTr->mItems.push_back(mit->second);
mit->second = NULL ; // avoids deletion mit->second = NULL ; // avoids deletion
#ifdef NXS_NET_DEBUG_1
GXSNETDEBUG_PG(tr->mTransaction->PeerId(),mit->first) << "RsGxsNetService::locked_genSendGrpsTransaction(): adding grp data of group \"" << mit->first << "\" to transaction" << std::endl;
#endif
} }
if(newTr->mItems.empty()){ if(newTr->mItems.empty()){
@ -4769,7 +4782,7 @@ void RsGxsNetService::processExplicitGroupRequests()
for(; git != groupIdList.end(); ++git) for(; git != groupIdList.end(); ++git)
{ {
#ifdef NXS_NET_DEBUG_0 #ifdef NXS_NET_DEBUG_0
GXSNETDEBUG_PG(peerId,*git) << " group request for grp ID " << *git << " to peer " << peerId << std::endl; GXSNETDEBUG_P_(peerId) << " group request for grp ID " << *git << " to peer " << peerId << std::endl;
#endif #endif
RsNxsSyncGrpItem* item = new RsNxsSyncGrpItem(mServType); RsNxsSyncGrpItem* item = new RsNxsSyncGrpItem(mServType);
item->grpId = *git; item->grpId = *git;

View file

@ -176,7 +176,7 @@ public:
* \brief Get the list of active virtual peers for a given group. This implies that a tunnel is up and * \brief Get the list of active virtual peers for a given group. This implies that a tunnel is up and
* alive. This function also "registers" the group which allows to handle tunnel requests in the server side. * alive. This function also "registers" the group which allows to handle tunnel requests in the server side.
*/ */
bool getVirtualPeers(std::list<RsGxsNetTunnelVirtualPeerId>& peers) ; // returns the virtual peers for this group bool getVirtualPeers(std::list<RsGxsNetTunnelVirtualPeerId>& peers) ; // returns the virtual peers for this service
/*! /*!
* \brief sendData * \brief sendData

View file

@ -47,6 +47,7 @@
#include <sstream> #include <sstream>
#include <stdio.h> #include <stdio.h>
#define DEBUG_IDS 1
/**** /****
* #define DEBUG_IDS 1 * #define DEBUG_IDS 1
* #define DEBUG_RECOGN 1 * #define DEBUG_RECOGN 1
@ -277,7 +278,7 @@ void p3IdService::timeStampKey(const RsGxsId& gxs_id, const RsIdentityUsage& rea
return ; return ;
} }
#ifdef DEBUG_IDS #ifdef DEBUG_IDS
std::cerr << "(II) time stamping key " << gxs_id << " for the following reason: " << reason << std::endl; std::cerr << "(II) time stamping key " << gxs_id << " for the following reason: " << reason.mUsageCode << std::endl;
#endif #endif
RS_STACK_MUTEX(mIdMtx) ; RS_STACK_MUTEX(mIdMtx) ;