removed debug info in p3postbase

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@8500 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
csoler 2015-06-16 19:03:40 +00:00
parent bb38ffbf14
commit be774c866a

View File

@ -354,8 +354,10 @@ void p3PostBase::background_requestUnprocessedGroup()
void p3PostBase::background_requestGroupMsgs(const RsGxsGroupId &grpId, bool unprocessedOnly) void p3PostBase::background_requestGroupMsgs(const RsGxsGroupId &grpId, bool unprocessedOnly)
{ {
#ifdef POSTBASE_DEBUG
std::cerr << "p3PostBase::background_requestGroupMsgs() id: " << grpId; std::cerr << "p3PostBase::background_requestGroupMsgs() id: " << grpId;
std::cerr << std::endl; std::cerr << std::endl;
#endif
uint32_t ansType = RS_TOKREQ_ANSTYPE_DATA; uint32_t ansType = RS_TOKREQ_ANSTYPE_DATA;
RsTokReqOptions opts; RsTokReqOptions opts;
@ -404,8 +406,10 @@ void p3PostBase::background_loadAllMsgs(const uint32_t &token)
void p3PostBase::background_loadMsgs(const uint32_t &token, bool unprocessed) void p3PostBase::background_loadMsgs(const uint32_t &token, bool unprocessed)
{ {
/* get messages */ /* get messages */
#ifdef POSTBASE_DEBUG
std::cerr << "p3PostBase::background_loadMsgs()"; std::cerr << "p3PostBase::background_loadMsgs()";
std::cerr << std::endl; std::cerr << std::endl;
#endif
std::map<RsGxsGroupId, std::vector<RsGxsMsgItem*> > msgData; std::map<RsGxsGroupId, std::vector<RsGxsMsgItem*> > msgData;
bool ok = RsGenExchange::getMsgData(token, msgData); bool ok = RsGenExchange::getMsgData(token, msgData);
@ -462,10 +466,12 @@ void p3PostBase::background_loadMsgs(const uint32_t &token, bool unprocessed)
RsStackMutex stack(mPostBaseMtx); /********** STACK LOCKED MTX ******/ RsStackMutex stack(mPostBaseMtx); /********** STACK LOCKED MTX ******/
if (mBgIncremental) if (mBgIncremental)
{ {
#ifdef POSTBASE_DEBUG
std::cerr << "p3PostBase::background_loadMsgs() Msg already Processed - Skipping"; std::cerr << "p3PostBase::background_loadMsgs() Msg already Processed - Skipping";
std::cerr << std::endl; std::cerr << std::endl;
std::cerr << "p3PostBase::background_loadMsgs() ERROR This should not happen"; std::cerr << "p3PostBase::background_loadMsgs() ERROR This should not happen";
std::cerr << std::endl; std::cerr << std::endl;
#endif
delete(*vit); delete(*vit);
continue; continue;
} }
@ -474,19 +480,23 @@ void p3PostBase::background_loadMsgs(const uint32_t &token, bool unprocessed)
/* 3 types expected: PostedPost, Comment and Vote */ /* 3 types expected: PostedPost, Comment and Vote */
if (parentId.isNull()) if (parentId.isNull())
{ {
#ifdef POSTBASE_DEBUG
/* we don't care about top-level (Posts) */ /* we don't care about top-level (Posts) */
std::cerr << "\tIgnoring TopLevel Item"; std::cerr << "\tIgnoring TopLevel Item";
std::cerr << std::endl; std::cerr << std::endl;
#endif
/* but we need to notify GUI about them */ /* but we need to notify GUI about them */
msgChanges->msgChangeMap[mit->first].push_back((*vit)->meta.mMsgId); msgChanges->msgChangeMap[mit->first].push_back((*vit)->meta.mMsgId);
} }
else if (NULL != (commentItem = dynamic_cast<RsGxsCommentItem *>(*vit))) else if (NULL != (commentItem = dynamic_cast<RsGxsCommentItem *>(*vit)))
{ {
#ifdef POSTBASE_DEBUG
/* comment - want all */ /* comment - want all */
/* Comments are counted by Thread Id */ /* Comments are counted by Thread Id */
std::cerr << "\tProcessing Comment: " << commentItem; std::cerr << "\tProcessing Comment: " << commentItem;
std::cerr << std::endl; std::cerr << std::endl;
#endif
inc_counters = true; inc_counters = true;
comment_inc = 1; comment_inc = 1;
@ -499,8 +509,10 @@ void p3PostBase::background_loadMsgs(const uint32_t &token, bool unprocessed)
/* Votes are organised by Parent Id, /* Votes are organised by Parent Id,
* ie. you can vote for both Posts and Comments * ie. you can vote for both Posts and Comments
*/ */
#ifdef POSTBASE_DEBUG
std::cerr << "\tProcessing Vote: " << voteItem; std::cerr << "\tProcessing Vote: " << voteItem;
std::cerr << std::endl; std::cerr << std::endl;
#endif
inc_counters = true; inc_counters = true;
add_voter = true; add_voter = true;
@ -550,11 +562,13 @@ void p3PostBase::background_loadMsgs(const uint32_t &token, bool unprocessed)
sit->second.voters.push_back(voterId); sit->second.voters.push_back(voterId);
} }
#ifdef POSTBASE_DEBUG
std::cerr << "\tThreadId: " << threadId; std::cerr << "\tThreadId: " << threadId;
std::cerr << " Comment Total: " << sit->second.comments; std::cerr << " Comment Total: " << sit->second.comments;
std::cerr << " UpVote Total: " << sit->second.up_votes; std::cerr << " UpVote Total: " << sit->second.up_votes;
std::cerr << " DownVote Total: " << sit->second.down_votes; std::cerr << " DownVote Total: " << sit->second.down_votes;
std::cerr << std::endl; std::cerr << std::endl;
#endif
} }
/* flag all messages as processed and new for the gui */ /* flag all messages as processed and new for the gui */
@ -571,8 +585,10 @@ void p3PostBase::background_loadMsgs(const uint32_t &token, bool unprocessed)
/* push updates of new Posts */ /* push updates of new Posts */
if (msgChanges->msgChangeMap.size() > 0) if (msgChanges->msgChangeMap.size() > 0)
{ {
#ifdef POSTBASE_DEBUG
std::cerr << "p3PostBase::background_processNewMessages() -> receiveChanges()"; std::cerr << "p3PostBase::background_processNewMessages() -> receiveChanges()";
std::cerr << std::endl; std::cerr << std::endl;
#endif
changes.push_back(msgChanges); changes.push_back(msgChanges);
receiveHelperChanges(changes); receiveHelperChanges(changes);
@ -622,8 +638,10 @@ bool extractPostCache(const std::string &str, PostStats &s)
void p3PostBase::background_updateVoteCounts(const uint32_t &token) void p3PostBase::background_updateVoteCounts(const uint32_t &token)
{ {
#ifdef POSTBASE_DEBUG
std::cerr << "p3PostBase::background_updateVoteCounts()"; std::cerr << "p3PostBase::background_updateVoteCounts()";
std::cerr << std::endl; std::cerr << std::endl;
#endif
GxsMsgMetaMap parentMsgList; GxsMsgMetaMap parentMsgList;
GxsMsgMetaMap::iterator mit; GxsMsgMetaMap::iterator mit;
@ -633,8 +651,10 @@ void p3PostBase::background_updateVoteCounts(const uint32_t &token)
if (!ok) if (!ok)
{ {
#ifdef POSTBASE_DEBUG
std::cerr << "p3PostBase::background_updateVoteCounts() ERROR"; std::cerr << "p3PostBase::background_updateVoteCounts() ERROR";
std::cerr << std::endl; std::cerr << std::endl;
#endif
background_cleanup(); background_cleanup();
return; return;
} }
@ -647,9 +667,11 @@ void p3PostBase::background_updateVoteCounts(const uint32_t &token)
{ {
for(vit = mit->second.begin(); vit != mit->second.end(); ++vit) for(vit = mit->second.begin(); vit != mit->second.end(); ++vit)
{ {
#ifdef POSTBASE_DEBUG
std::cerr << "p3PostBase::background_updateVoteCounts() Processing Msg(" << mit->first; std::cerr << "p3PostBase::background_updateVoteCounts() Processing Msg(" << mit->first;
std::cerr << ", " << vit->mMsgId << ")"; std::cerr << ", " << vit->mMsgId << ")";
std::cerr << std::endl; std::cerr << std::endl;
#endif
RsStackMutex stack(mPostBaseMtx); /********** STACK LOCKED MTX ******/ RsStackMutex stack(mPostBaseMtx); /********** STACK LOCKED MTX ******/
@ -675,19 +697,23 @@ void p3PostBase::background_updateVoteCounts(const uint32_t &token)
if (it != mBgStatsMap.end()) if (it != mBgStatsMap.end())
{ {
#ifdef POSTBASE_DEBUG
std::cerr << "p3PostBase::background_updateVoteCounts() Adding to msgChangeMap: "; std::cerr << "p3PostBase::background_updateVoteCounts() Adding to msgChangeMap: ";
std::cerr << mit->first << " MsgId: " << vit->mMsgId; std::cerr << mit->first << " MsgId: " << vit->mMsgId;
std::cerr << std::endl; std::cerr << std::endl;
#endif
stats.increment(it->second); stats.increment(it->second);
msgChanges->msgChangeMap[mit->first].push_back(vit->mMsgId); msgChanges->msgChangeMap[mit->first].push_back(vit->mMsgId);
} }
else else
{ {
#ifdef POSTBASE_DEBUG
// warning. // warning.
std::cerr << "p3PostBase::background_updateVoteCounts() Warning No New Votes found."; std::cerr << "p3PostBase::background_updateVoteCounts() Warning No New Votes found.";
std::cerr << " For MsgId: " << vit->mMsgId; std::cerr << " For MsgId: " << vit->mMsgId;
std::cerr << std::endl; std::cerr << std::endl;
#endif
} }
std::string str; std::string str;
@ -698,8 +724,10 @@ void p3PostBase::background_updateVoteCounts(const uint32_t &token)
} }
else else
{ {
#ifdef POSTBASE_DEBUG
std::cerr << "p3PostBase::background_updateVoteCounts() Encoded String: " << str; std::cerr << "p3PostBase::background_updateVoteCounts() Encoded String: " << str;
std::cerr << std::endl; std::cerr << std::endl;
#endif
/* store new result */ /* store new result */
uint32_t token_c; uint32_t token_c;
RsGxsGrpMsgIdPair msgId = std::make_pair(vit->mGroupId, vit->mMsgId); RsGxsGrpMsgIdPair msgId = std::make_pair(vit->mGroupId, vit->mMsgId);
@ -710,8 +738,10 @@ void p3PostBase::background_updateVoteCounts(const uint32_t &token)
if (msgChanges->msgChangeMap.size() > 0) if (msgChanges->msgChangeMap.size() > 0)
{ {
#ifdef POSTBASE_DEBUG
std::cerr << "p3PostBase::background_updateVoteCounts() -> receiveChanges()"; std::cerr << "p3PostBase::background_updateVoteCounts() -> receiveChanges()";
std::cerr << std::endl; std::cerr << std::endl;
#endif
changes.push_back(msgChanges); changes.push_back(msgChanges);
receiveHelperChanges(changes); receiveHelperChanges(changes);
@ -730,8 +760,10 @@ void p3PostBase::background_updateVoteCounts(const uint32_t &token)
bool p3PostBase::background_cleanup() bool p3PostBase::background_cleanup()
{ {
#ifdef POSTBASE_DEBUG
std::cerr << "p3PostBase::background_cleanup()"; std::cerr << "p3PostBase::background_cleanup()";
std::cerr << std::endl; std::cerr << std::endl;
#endif
RsStackMutex stack(mPostBaseMtx); /********** STACK LOCKED MTX ******/ RsStackMutex stack(mPostBaseMtx); /********** STACK LOCKED MTX ******/
@ -746,8 +778,10 @@ bool p3PostBase::background_cleanup()
// Overloaded from GxsTokenQueue for Request callbacks. // Overloaded from GxsTokenQueue for Request callbacks.
void p3PostBase::handleResponse(uint32_t token, uint32_t req_type) void p3PostBase::handleResponse(uint32_t token, uint32_t req_type)
{ {
#ifdef POSTBASE_DEBUG
std::cerr << "p3PostBase::handleResponse(" << token << "," << req_type << ")"; std::cerr << "p3PostBase::handleResponse(" << token << "," << req_type << ")";
std::cerr << std::endl; std::cerr << std::endl;
#endif
// stuff. // stuff.
switch(req_type) switch(req_type)