mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-27 00:19:25 -05:00
removed debug info fom gxscommon
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@7878 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
3a64bc2601
commit
beb7c84898
@ -32,6 +32,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
|
||||
//#define DEBUG_GXSCOMMON
|
||||
|
||||
RsGxsComment::RsGxsComment()
|
||||
{
|
||||
@ -45,16 +46,20 @@ RsGxsComment::RsGxsComment()
|
||||
|
||||
RsGxsImage::RsGxsImage()
|
||||
{
|
||||
#ifdef DEBUG_GXSCOMMON
|
||||
std::cerr << "RsGxsImage(" << this << ")";
|
||||
std::cerr << std::endl;
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
mData = NULL;
|
||||
mSize = 0;
|
||||
}
|
||||
|
||||
RsGxsImage::RsGxsImage(const RsGxsImage& a)
|
||||
{
|
||||
std::cerr << "RsGxsImage(" << this << ") = RsGxsImage(" << (void *) &a << ")";
|
||||
std::cerr << std::endl;
|
||||
#ifdef DEBUG_GXSCOMMON
|
||||
std::cerr << "RsGxsImage(" << this << ") = RsGxsImage(" << (void *) &a << ")";
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
mData = NULL;
|
||||
mSize = 0;
|
||||
copy(a.mData, a.mSize);
|
||||
@ -63,8 +68,10 @@ RsGxsImage::RsGxsImage(const RsGxsImage& a)
|
||||
|
||||
RsGxsImage::~RsGxsImage()
|
||||
{
|
||||
std::cerr << "~RsGxsImage(" << this << ")";
|
||||
std::cerr << std::endl;
|
||||
#ifdef DEBUG_GXSCOMMON
|
||||
std::cerr << "~RsGxsImage(" << this << ")";
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
clear();
|
||||
}
|
||||
|
||||
@ -78,8 +85,10 @@ RsGxsImage &RsGxsImage::operator=(const RsGxsImage &a)
|
||||
|
||||
void RsGxsImage::take(uint8_t *data, uint32_t size)
|
||||
{
|
||||
std::cerr << "RsGxsImage(" << this << ")::take(" << (void *) data << "," << size << ")";
|
||||
std::cerr << std::endl;
|
||||
#ifdef DEBUG_GXSCOMMON
|
||||
std::cerr << "RsGxsImage(" << this << ")::take(" << (void *) data << "," << size << ")";
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
// Copies Pointer.
|
||||
clear();
|
||||
mData = data;
|
||||
@ -90,22 +99,28 @@ void RsGxsImage::take(uint8_t *data, uint32_t size)
|
||||
uint8_t *RsGxsImage::allocate(uint32_t size)
|
||||
{
|
||||
uint8_t *val = (uint8_t *) malloc(size);
|
||||
std::cerr << "RsGxsImage()::allocate(" << (void *) val << ")";
|
||||
std::cerr << std::endl;
|
||||
#ifdef DEBUG_GXSCOMMON
|
||||
std::cerr << "RsGxsImage()::allocate(" << (void *) val << ")";
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
return val;
|
||||
}
|
||||
|
||||
void RsGxsImage::release(void *data)
|
||||
{
|
||||
std::cerr << "RsGxsImage()::release(" << (void *) data << ")";
|
||||
std::cerr << std::endl;
|
||||
#ifdef DEBUG_GXSCOMMON
|
||||
std::cerr << "RsGxsImage()::release(" << (void *) data << ")";
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
free(data);
|
||||
}
|
||||
|
||||
void RsGxsImage::copy(uint8_t *data, uint32_t size)
|
||||
{
|
||||
std::cerr << "RsGxsImage(" << this << ")::copy(" << (void *) data << "," << size << ")";
|
||||
std::cerr << std::endl;
|
||||
#ifdef DEBUG_GXSCOMMON
|
||||
std::cerr << "RsGxsImage(" << this << ")::copy(" << (void *) data << "," << size << ")";
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
// Allocates and Copies.
|
||||
clear();
|
||||
if (data && size)
|
||||
@ -167,8 +182,10 @@ void p3GxsCommentService::comment_tick()
|
||||
|
||||
bool p3GxsCommentService::getGxsCommentData(const uint32_t &token, std::vector<RsGxsComment> &comments)
|
||||
{
|
||||
std::cerr << "p3GxsCommentService::getGxsCommentData()";
|
||||
std::cerr << std::endl;
|
||||
#ifdef DEBUG_GXSCOMMON
|
||||
std::cerr << "p3GxsCommentService::getGxsCommentData()";
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
|
||||
GxsMsgDataMap msgData;
|
||||
bool ok = mExchange->getMsgData(token, msgData);
|
||||
@ -249,10 +266,12 @@ bool p3GxsCommentService::getGxsCommentData(const uint32_t &token, std::vector<R
|
||||
}
|
||||
}
|
||||
|
||||
std::cerr << "p3GxsCommentService::getGxsCommentData() Found " << comments.size() << " Comments";
|
||||
#ifdef DEBUG_GXSCOMMON
|
||||
std::cerr << "p3GxsCommentService::getGxsCommentData() Found " << comments.size() << " Comments";
|
||||
std::cerr << std::endl;
|
||||
std::cerr << "p3GxsCommentService::getGxsCommentData() Found " << voteMap.size() << " Votes";
|
||||
std::cerr << std::endl;
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
|
||||
/* delete the votes */
|
||||
for (it = voteMap.begin(); it != voteMap.end(); ++it)
|
||||
@ -272,8 +291,10 @@ bool p3GxsCommentService::getGxsCommentData(const uint32_t &token, std::vector<R
|
||||
|
||||
bool p3GxsCommentService::getGxsRelatedComments(const uint32_t &token, std::vector<RsGxsComment> &comments)
|
||||
{
|
||||
std::cerr << "p3GxsCommentService::getGxsRelatedComments()";
|
||||
std::cerr << std::endl;
|
||||
#ifdef DEBUG_GXSCOMMON
|
||||
std::cerr << "p3GxsCommentService::getGxsRelatedComments()";
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
|
||||
GxsMsgRelatedDataMap msgData;
|
||||
bool ok = mExchange->getMsgRelatedData(token, msgData);
|
||||
@ -351,10 +372,12 @@ bool p3GxsCommentService::getGxsRelatedComments(const uint32_t &token, std::vect
|
||||
}
|
||||
}
|
||||
|
||||
std::cerr << "p3GxsCommentService::getGxsRelatedComments() Found " << comments.size() << " Comments";
|
||||
#ifdef DEBUG_GXSCOMMON
|
||||
std::cerr << "p3GxsCommentService::getGxsRelatedComments() Found " << comments.size() << " Comments";
|
||||
std::cerr << std::endl;
|
||||
std::cerr << "p3GxsCommentService::getGxsRelatedComments() Found " << voteMap.size() << " Votes";
|
||||
std::cerr << std::endl;
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
|
||||
/* delete the votes */
|
||||
for (it = voteMap.begin(); it != voteMap.end(); ++it)
|
||||
@ -392,8 +415,10 @@ double p3GxsCommentService::calculateBestScore(int upVotes, int downVotes)
|
||||
|
||||
bool p3GxsCommentService::createGxsComment(uint32_t &token, RsGxsComment &msg)
|
||||
{
|
||||
std::cerr << "p3GxsCommentService::createGxsComment() GroupId: " << msg.mMeta.mGroupId;
|
||||
std::cerr << std::endl;
|
||||
#ifdef DEBUG_GXSCOMMON
|
||||
std::cerr << "p3GxsCommentService::createGxsComment() GroupId: " << msg.mMeta.mGroupId;
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
|
||||
RsGxsCommentItem* msgItem = new RsGxsCommentItem(mServiceType);
|
||||
msgItem->mMsg = msg;
|
||||
@ -410,12 +435,14 @@ bool p3GxsCommentService::createGxsVote(uint32_t &token, RsGxsVote &vote)
|
||||
// NOTE Because we cannot do this operation immediately, we create a token,
|
||||
// and monitor acknowledgeTokenMsg ... to return correct answer.
|
||||
|
||||
std::cerr << "p3GxsCommentService::createGxsVote() GroupId: " << vote.mMeta.mGroupId;
|
||||
std::cerr << std::endl;
|
||||
#ifdef DEBUG_GXSCOMMON
|
||||
std::cerr << "p3GxsCommentService::createGxsVote() GroupId: " << vote.mMeta.mGroupId;
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
|
||||
/* vote must be associated with another item */
|
||||
if (vote.mMeta.mThreadId.isNull())
|
||||
{
|
||||
{
|
||||
std::cerr << "p3GxsCommentService::createGxsVote() ERROR Missing Required ThreadId";
|
||||
std::cerr << std::endl;
|
||||
return false;
|
||||
@ -482,8 +509,10 @@ bool p3GxsCommentService::createGxsVote(uint32_t &token, RsGxsVote &vote)
|
||||
|
||||
void p3GxsCommentService::load_PendingVoteParent(const uint32_t &token)
|
||||
{
|
||||
#ifdef DEBUG_GXSCOMMON
|
||||
std::cerr << "p3GxsCommentService::load_PendingVoteParent()";
|
||||
std::cerr << std::endl;
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
GxsMsgMetaMap msginfo;
|
||||
if (!mExchange->getMsgMeta(token, msginfo))
|
||||
{
|
||||
@ -505,9 +534,11 @@ void p3GxsCommentService::load_PendingVoteParent(const uint32_t &token)
|
||||
/* find the matching Pending Vote */
|
||||
RsMsgMetaData &meta = *mit;
|
||||
|
||||
std::cerr << "p3GxsCommentService::load_PendingVoteParent() recv (groupId: " << meta.mGroupId;
|
||||
std::cerr << ", msgId: " << meta.mMsgId << ")";
|
||||
std::cerr << std::endl;
|
||||
#ifdef DEBUG_GXSCOMMON
|
||||
std::cerr << "p3GxsCommentService::load_PendingVoteParent() recv (groupId: " << meta.mGroupId;
|
||||
std::cerr << ", msgId: " << meta.mMsgId << ")";
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
|
||||
RsGxsGrpMsgIdPair parentId(meta.mGroupId, meta.mMsgId);
|
||||
std::map<RsGxsGrpMsgIdPair, VoteHolder>::iterator pit;
|
||||
@ -535,8 +566,10 @@ void p3GxsCommentService::load_PendingVoteParent(const uint32_t &token)
|
||||
continue;
|
||||
}
|
||||
|
||||
std::cerr << "p3GxsCommentService::load_PendingVoteParent() submitting Vote";
|
||||
std::cerr << std::endl;
|
||||
#ifdef DEBUG_GXSCOMMON
|
||||
std::cerr << "p3GxsCommentService::load_PendingVoteParent() submitting Vote";
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
|
||||
uint32_t status_token;
|
||||
if (vote.mVoteType == GXS_VOTE_UP)
|
||||
@ -564,8 +597,10 @@ void p3GxsCommentService::load_PendingVoteParent(const uint32_t &token)
|
||||
|
||||
void p3GxsCommentService::completeInternalVote(uint32_t &token)
|
||||
{
|
||||
std::cerr << "p3GxsCommentService::completeInternalVote() token: " << token;
|
||||
std::cerr << std::endl;
|
||||
#ifdef DEBUG_GXSCOMMON
|
||||
std::cerr << "p3GxsCommentService::completeInternalVote() token: " << token;
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
std::map<RsGxsGrpMsgIdPair, VoteHolder>::iterator it;
|
||||
for (it = mPendingVotes.begin(); it != mPendingVotes.end(); ++it)
|
||||
{
|
||||
@ -575,8 +610,10 @@ void p3GxsCommentService::completeInternalVote(uint32_t &token)
|
||||
uint32_t status = mExchange->getTokenService()->requestStatus(token);
|
||||
mExchange->updatePublicRequestStatus(it->second.mReqToken, status);
|
||||
|
||||
std::cerr << "p3GxsCommentService::completeInternalVote() Matched to PendingVote. status: " << status;
|
||||
std::cerr << std::endl;
|
||||
#ifdef DEBUG_GXSCOMMON
|
||||
std::cerr << "p3GxsCommentService::completeInternalVote() Matched to PendingVote. status: " << status;
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
|
||||
it->second.mStatus = VoteHolder::VOTE_READY;
|
||||
return;
|
||||
@ -592,48 +629,58 @@ void p3GxsCommentService::completeInternalVote(uint32_t &token)
|
||||
|
||||
bool p3GxsCommentService::acknowledgeVote(const uint32_t& token, RsGxsGrpMsgIdPair& msgId)
|
||||
{
|
||||
std::cerr << "p3GxsCommentService::acknowledgeVote() token: " << token;
|
||||
std::cerr << std::endl;
|
||||
#ifdef DEBUG_GXSCOMMON
|
||||
std::cerr << "p3GxsCommentService::acknowledgeVote() token: " << token;
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
|
||||
std::map<RsGxsGrpMsgIdPair, VoteHolder>::iterator it;
|
||||
for (it = mPendingVotes.begin(); it != mPendingVotes.end(); ++it)
|
||||
{
|
||||
if (it->second.mReqToken == token)
|
||||
{
|
||||
std::cerr << "p3GxsCommentService::acknowledgeVote() Matched to PendingVote";
|
||||
std::cerr << std::endl;
|
||||
#ifdef DEBUG_GXSCOMMON
|
||||
std::cerr << "p3GxsCommentService::acknowledgeVote() Matched to PendingVote";
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
|
||||
bool ans = false;
|
||||
if (it->second.mStatus == VoteHolder::VOTE_READY)
|
||||
{
|
||||
std::cerr << "p3GxsCommentService::acknowledgeVote() PendingVote = READY";
|
||||
std::cerr << std::endl;
|
||||
#ifdef DEBUG_GXSCOMMON
|
||||
std::cerr << "p3GxsCommentService::acknowledgeVote() PendingVote = READY";
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
|
||||
// Finally finish this Vote off.
|
||||
ans = mExchange->acknowledgeTokenMsg(it->second.mVoteToken, msgId);
|
||||
}
|
||||
else if (it->second.mStatus == VoteHolder::VOTE_ERROR)
|
||||
{
|
||||
{
|
||||
std::cerr << "p3GxsCommentService::acknowledgeVote() PendingVote = ERROR ???";
|
||||
std::cerr << std::endl;
|
||||
}
|
||||
else
|
||||
#ifdef DEBUG_GXSCOMMON
|
||||
else
|
||||
{
|
||||
std::cerr << "p3GxsCommentService::acknowledgeVote() PendingVote = OTHER STATUS";
|
||||
std::cerr << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
std::cerr << "p3GxsCommentService::acknowledgeVote() cleanup token & PendingVote";
|
||||
std::cerr << std::endl;
|
||||
mExchange->disposeOfPublicToken(it->second.mReqToken);
|
||||
#endif
|
||||
mExchange->disposeOfPublicToken(it->second.mReqToken);
|
||||
mPendingVotes.erase(it);
|
||||
|
||||
return ans;
|
||||
}
|
||||
}
|
||||
|
||||
std::cerr << "p3GxsCommentService::acknowledgeVote() Failed to match PendingVote";
|
||||
std::cerr << std::endl;
|
||||
#ifdef DEBUG_GXSCOMMON
|
||||
std::cerr << "p3GxsCommentService::acknowledgeVote() Failed to match PendingVote";
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
|
||||
return false;
|
||||
}
|
||||
@ -642,8 +689,10 @@ bool p3GxsCommentService::acknowledgeVote(const uint32_t& token, RsGxsGrpMsgIdPa
|
||||
// Overloaded from GxsTokenQueue for Request callbacks.
|
||||
void p3GxsCommentService::handleResponse(uint32_t token, uint32_t req_type)
|
||||
{
|
||||
#ifdef DEBUG_GXSCOMMON
|
||||
std::cerr << "p3GxsCommentService::handleResponse(" << token << "," << req_type << ")";
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
|
||||
// stuff.
|
||||
switch(req_type)
|
||||
@ -670,8 +719,10 @@ void p3GxsCommentService::handleResponse(uint32_t token, uint32_t req_type)
|
||||
|
||||
bool p3GxsCommentService::castVote(uint32_t &token, RsGxsVote &msg)
|
||||
{
|
||||
std::cerr << "p3GxsCommentService::castVote() GroupId: " << msg.mMeta.mGroupId;
|
||||
std::cerr << std::endl;
|
||||
#ifdef DEBUG_GXSCOMMON
|
||||
std::cerr << "p3GxsCommentService::castVote() GroupId: " << msg.mMeta.mGroupId;
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
|
||||
RsGxsVoteItem* msgItem = new RsGxsVoteItem(mServiceType);
|
||||
msgItem->mMsg = msg;
|
||||
|
Loading…
Reference in New Issue
Block a user