added some debug info in p3gxschannels.cc

This commit is contained in:
csoler 2020-09-03 20:53:57 +02:00
parent 97762093ce
commit 05daa0387b
2 changed files with 21 additions and 9 deletions

View File

@ -61,7 +61,7 @@ static const uint32_t INDEX_AUTHEN_ADMIN = 0x00000040; // admin key
#define GXS_MASK "GXS_MASK_HACK" #define GXS_MASK "GXS_MASK_HACK"
//#define GEN_EXCH_DEBUG 1 #define GEN_EXCH_DEBUG 1
static const uint32_t MSG_CLEANUP_PERIOD = 60*59; // 59 minutes static const uint32_t MSG_CLEANUP_PERIOD = 60*59; // 59 minutes
static const uint32_t INTEGRITY_CHECK_PERIOD = 60*31; // 31 minutes static const uint32_t INTEGRITY_CHECK_PERIOD = 60*31; // 31 minutes

View File

@ -237,11 +237,10 @@ RsGenExchange::ServiceCreate_Return p3GxsChannels::service_CreateGroup(RsGxsGrpI
void p3GxsChannels::notifyChanges(std::vector<RsGxsNotify *> &changes) void p3GxsChannels::notifyChanges(std::vector<RsGxsNotify *> &changes)
{ {
#ifdef GXSCHANNELS_DEBUG #ifdef GXSCHANNEL_DEBUG
std::cerr << "p3GxsChannels::notifyChanges() : " << changes.size() << "changes to notify" << std::endl; RsDbg() << " Processing " << changes.size() << " channel changes..." << std::endl;
#endif #endif
/* iterate through and grab any new messages */
/* iterate through and grab any new messages */
std::set<RsGxsGroupId> unprocessedGroups; std::set<RsGxsGroupId> unprocessedGroups;
std::vector<RsGxsNotify *>::iterator it; std::vector<RsGxsNotify *>::iterator it;
@ -295,6 +294,10 @@ void p3GxsChannels::notifyChanges(std::vector<RsGxsNotify *> &changes)
if (grpChange && rsEvents) if (grpChange && rsEvents)
{ {
#ifdef GXSCHANNEL_DEBUG
RsDbg() << " Grp Change Event or type " << grpChange->getType() << ":" << std::endl;
#endif
switch (grpChange->getType()) switch (grpChange->getType())
{ {
case RsGxsNotify::TYPE_PROCESSED: // happens when the group is subscribed case RsGxsNotify::TYPE_PROCESSED: // happens when the group is subscribed
@ -322,18 +325,27 @@ void p3GxsChannels::notifyChanges(std::vector<RsGxsNotify *> &changes)
RS_STACK_MUTEX(mKnownChannelsMutex); RS_STACK_MUTEX(mKnownChannelsMutex);
if(mKnownChannels.find(grpChange->mGroupId) == mKnownChannels.end()) #ifdef GXSCHANNEL_DEBUG
RsDbg() << " Type = Published/New " << std::endl;
#endif
if(mKnownChannels.find(grpChange->mGroupId) == mKnownChannels.end())
{ {
mKnownChannels.insert(std::make_pair(grpChange->mGroupId,time(NULL))) ; #ifdef GXSCHANNEL_DEBUG
RsDbg() << " Status: unknown. Sending notification event." << std::endl;
#endif
mKnownChannels.insert(std::make_pair(grpChange->mGroupId,time(NULL))) ;
IndicateConfigChanged(); IndicateConfigChanged();
auto ev = std::make_shared<RsGxsChannelEvent>(); auto ev = std::make_shared<RsGxsChannelEvent>();
ev->mChannelGroupId = grpChange->mGroupId; ev->mChannelGroupId = grpChange->mGroupId;
ev->mChannelEventCode = RsChannelEventCode::NEW_CHANNEL; ev->mChannelEventCode = RsChannelEventCode::NEW_CHANNEL;
rsEvents->postEvent(ev); rsEvents->postEvent(ev);
} }
#ifdef GXSCHANNEL_DEBUG
else else
std::cerr << "(II) Not notifying already known channel " << grpChange->mGroupId << std::endl; RsDbg() << " Not notifying already known channel " << grpChange->mGroupId << std::endl;
#endif
} }
break; break;