removed some debug messages, added some ifdefs

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@7775 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
csoler 2014-12-21 19:12:40 +00:00
parent a895261bd5
commit acc45a4382
8 changed files with 177 additions and 13 deletions

View File

@ -461,7 +461,6 @@ int p3BitDht::ConnectCallback(const bdId *srcId, const bdId *proxyId, const bdId
uint32_t mode, uint32_t point, uint32_t param, uint32_t cbtype, uint32_t errcode)
{
#ifdef DEBUG_PEERNET
#endif
std::cerr << "p3BitDht::ConnectCallback()";
std::cerr << std::endl;
std::cerr << "srcId: ";
@ -479,6 +478,7 @@ int p3BitDht::ConnectCallback(const bdId *srcId, const bdId *proxyId, const bdId
std::cerr << " point: " << point;
std::cerr << " cbtype: " << cbtype;
std::cerr << std::endl;
#endif
/* we handle MID and START/END points differently... this is biggest difference.
@ -898,7 +898,6 @@ int p3BitDht::ConnectCallback(const bdId *srcId, const bdId *proxyId, const bdId
case BITDHT_CONNECT_CB_FAILED:
{
#ifdef DEBUG_PEERNET
#endif
std::cerr << "dhtConnectionCallback() Connection Attempt Failed with:";
bdStdPrintId(std::cerr, &(peerId));
std::cerr << std::endl;
@ -915,6 +914,7 @@ int p3BitDht::ConnectCallback(const bdId *srcId, const bdId *proxyId, const bdId
std::cerr << " ErrorSrc: " << errsrc;
std::cerr << " ErrorType: " << errtype;
std::cerr << std::endl;
#endif
RsStackMutex stack(dhtMtx); /********** LOCKED MUTEX ***************/
@ -1873,7 +1873,6 @@ void p3BitDht::initiateConnection(const bdId *srcId, const bdId *proxyId, const
uint32_t mode, uint32_t loc, uint32_t delayOrBandwidth)
{
#ifdef DEBUG_PEERNET
#endif
std::cerr << "p3BitDht::initiateConnection()";
std::cerr << std::endl;
std::cerr << "\t srcId: ";
@ -1892,6 +1891,7 @@ void p3BitDht::initiateConnection(const bdId *srcId, const bdId *proxyId, const
std::cerr << std::endl;
std::cerr << "\t DelayOrBandwidth: " << delayOrBandwidth;
std::cerr << std::endl;
#endif
bdId peerConnectId;
@ -2376,10 +2376,10 @@ void p3BitDht::UdpConnectionFailed_locked(DhtPeerDetails *dpd)
void p3BitDht::ReleaseProxyExclusiveMode_locked(DhtPeerDetails *dpd, bool addrChgLikely)
{
#ifdef DEBUG_BITDHT_COMMON
#endif
std::cerr << "p3BitDht::ReleaseProxyExclusiveMode_locked()";
bdStdPrintNodeId(std::cerr, &(dpd->mDhtId.id));
std::cerr << std::endl;
#endif
/* translate id into string for exclusive mode */
std::string pid;
@ -2393,10 +2393,10 @@ void p3BitDht::ReleaseProxyExclusiveMode_locked(DhtPeerDetails *dpd, bool addrCh
dpd->mExclusiveProxyLock = false;
#ifdef DEBUG_PEERNET
#endif
std::cerr << "p3BitDht::ReleaseProxyExclusiveMode_locked() Lock released by Connection to peer: ";
bdStdPrintNodeId(std::cerr, &(dpd->mDhtId.id));
std::cerr << std::endl;
#endif
}
else
{
@ -2411,9 +2411,9 @@ void p3BitDht::ReleaseProxyExclusiveMode_locked(DhtPeerDetails *dpd, bool addrCh
else
{
#ifdef DEBUG_BITDHT_COMMON
#endif
std::cerr << "p3BitDht::ReleaseProxyExclusiveMode_locked() Don't Have a Lock";
std::cerr << std::endl;
#endif
}
}

View File

@ -222,7 +222,7 @@ int p3BitDht::addKnownPeer(const RsPeerId &pid, const struct sockaddr_storage &a
if (addr.ss_family != AF_INET)
{
std::cerr << "p3BitDht::addKnownPeer() Warning! Non IPv4 Address - Cannot handle IPV6 Yet.";
std::cerr << "p3BitDht::addKnownPeer() Warning! Non IPv4 Address - Cannot handle IPV6 Yet. addr.ss_family=" << addr.ss_family;
std::cerr << std::endl;
sockaddr_clear(&addrv4);

View File

@ -177,7 +177,9 @@ public:
RsConfigDataRates rates ;
rsConfig->getTotalBandwidthRates(rates) ;
#ifdef NXS_NET_DEBUG
std::cerr << std::dec << std::endl;
#endif
float outqueue_factor = 1.0f/pow( std::max(0.02f,rates.mQueueOut / (float)OUTQUEUE_CUTOFF_VALUE),5.0f) ;
float accepted_bandwidth = std::max( 0.0f, maxOut - currOut) ;
@ -2057,7 +2059,9 @@ void RsGxsNetService::locked_genReqGrpTransaction(NxsTransaction* tr)
// then what grps to request
// then add an active Transaction for request
#ifdef NXS_NET_DEBUG
std::cerr << "locked_genReqGrpTransaction(): " << std::endl;
#endif
std::list<RsNxsSyncGrpItem*> grpItemL;
std::list<RsNxsItem*>::iterator lit = tr->mItems.begin();

View File

@ -158,10 +158,12 @@ bool p3PeerMgrIMPL::setupHiddenNode(const std::string &hiddenAddress, const uint
{
RsStackMutex stack(mPeerMtx); /****** STACK LOCK MUTEX *******/
#ifdef PEER_DEBUG
std::cerr << "p3PeerMgrIMPL::setupHiddenNode()";
std::cerr << " Address: " << hiddenAddress;
std::cerr << " Port: " << hiddenPort;
std::cerr << std::endl;
#endif
mOwnState.hiddenNode = true;
mOwnState.hiddenPort = hiddenPort;
@ -179,8 +181,10 @@ bool p3PeerMgrIMPL::forceHiddenNode()
RsStackMutex stack(mPeerMtx); /****** STACK LOCK MUTEX *******/
if (RS_NET_MODE_HIDDEN != mOwnState.netMode)
{
#ifdef PEER_DEBUG
std::cerr << "p3PeerMgrIMPL::forceHiddenNode() Required!";
std::cerr << std::endl;
#endif
}
mOwnState.hiddenNode = true;
@ -278,9 +282,11 @@ void p3PeerMgrIMPL::tick()
if(now - last_friends_check > INTERVAL_BETWEEN_LOCATION_CLEANING)
{
#ifdef PEER_DEBUG
std::cerr << "p3PeerMgrIMPL::tick(): cleaning unused locations." << std::endl ;
#endif
rslog(RSL_WARNING, p3peermgrzone, "p3PeerMgr::tick() removeUnusedLocations()");
rslog(RSL_WARNING, p3peermgrzone, "p3PeerMgr::tick() removeUnusedLocations()");
removeUnusedLocations() ;
last_friends_check = now ;
@ -369,14 +375,18 @@ bool p3PeerMgrIMPL::isHiddenPeer(const RsPeerId &ssl_id)
it = mFriendList.find(ssl_id);
if (it == mFriendList.end())
{
#ifdef PEER_DEBUG
std::cerr << "p3PeerMgrIMPL::isHiddenPeer(" << ssl_id << ") Missing Peer => false";
std::cerr << std::endl;
#endif
return false;
}
#ifdef PEER_DEBUG
std::cerr << "p3PeerMgrIMPL::isHiddenPeer(" << ssl_id << ") = " << (it->second).hiddenNode;
std::cerr << std::endl;
#endif
return (it->second).hiddenNode;
}
@ -384,8 +394,10 @@ bool p3PeerMgrIMPL::setHiddenDomainPort(const RsPeerId &ssl_id, const std::strin
{
RsStackMutex stack(mPeerMtx); /****** STACK LOCK MUTEX *******/
#ifdef PEER_DEBUG
std::cerr << "p3PeerMgrIMPL::setHiddenDomainPort()";
std::cerr << std::endl;
#endif
std::string domain = domain_addr;
// trim whitespace!
@ -407,8 +419,10 @@ bool p3PeerMgrIMPL::setHiddenDomainPort(const RsPeerId &ssl_id, const std::strin
mOwnState.hiddenNode = true;
mOwnState.hiddenDomain = domain;
mOwnState.hiddenPort = domain_port;
#ifdef PEER_DEBUG
std::cerr << "p3PeerMgrIMPL::setHiddenDomainPort() Set own State";
std::cerr << std::endl;
#endif
return true;
}
@ -417,16 +431,20 @@ bool p3PeerMgrIMPL::setHiddenDomainPort(const RsPeerId &ssl_id, const std::strin
it = mFriendList.find(ssl_id);
if (it == mFriendList.end())
{
#ifdef PEER_DEBUG
std::cerr << "p3PeerMgrIMPL::setHiddenDomainPort() Peer Not Found";
std::cerr << std::endl;
#endif
return false;
}
it->second.hiddenDomain = domain;
it->second.hiddenPort = domain_port;
it->second.hiddenNode = true;
#ifdef PEER_DEBUG
std::cerr << "p3PeerMgrIMPL::setHiddenDomainPort() Set Peers State";
std::cerr << std::endl;
#endif
return true;
}
@ -949,11 +967,13 @@ void p3PeerMgrIMPL::printPeerLists(std::ostream &out)
bool p3PeerMgrIMPL::UpdateOwnAddress(const struct sockaddr_storage &localAddr, const struct sockaddr_storage &extAddr)
{
#ifdef PEER_DEBUG
std::cerr << "p3PeerMgrIMPL::UpdateOwnAddress(";
std::cerr << sockaddr_storage_tostring(localAddr);
std::cerr << ", ";
std::cerr << sockaddr_storage_tostring(extAddr);
std::cerr << ")" << std::endl;
#endif
{
RsStackMutex stack(mPeerMtx); /****** STACK LOCK MUTEX *******/
@ -1163,9 +1183,9 @@ bool p3PeerMgrIMPL::setDynDNS(const RsPeerId &id, const std::string &dyndns)
{
if (mOthersList.end() == (it = mOthersList.find(id)))
{
#ifdef PEER_DEBUG
#ifdef PEER_DEBUG
std::cerr << "p3PeerMgrIMPL::setDynDNS() cannot add dyn dns info : peer id not found in friend list id: " << id << std::endl;
#endif
#endif
return false;
}
}
@ -1399,6 +1419,7 @@ bool p3PeerMgrIMPL::setVisState(const RsPeerId &id, uint16_t vs_disc, uint16_
it->second.vs_dht = vs_dht;
changed = true;
#ifdef PEER_DEBUG
std::cerr << "p3PeerMgrIMPL::setVisState(" << id << ", DISC: " << vs_disc << " DHT: " << vs_dht << ") ";
std::cerr << " NAME: " << it->second.name;
@ -1429,6 +1450,7 @@ bool p3PeerMgrIMPL::setVisState(const RsPeerId &id, uint16_t vs_disc, uint16_
break;
}
std::cerr << std::endl;
#endif
}
}
if(isFriend && changed)
@ -1586,8 +1608,10 @@ bool p3PeerMgrIMPL::saveList(bool &cleanup, std::list<RsItem *>& saveData)
vitem->tlvkvs.pairs.push_back(kv) ;
#ifdef PEER_DEBUG
std::cerr << "Saving proxyServerAddress: " << sockaddr_storage_tostring(proxy_addr);
std::cerr << std::endl;
#endif
kv.key = kConfigKeyProxyServerIpAddr;
kv.value = sockaddr_storage_iptostring(proxy_addr);
@ -1722,20 +1746,26 @@ bool p3PeerMgrIMPL::loadList(std::list<RsItem *>& load)
if (kit->key == kConfigKeyExtIpFinder)
{
useExtAddrFinder = (kit->value == "TRUE");
#ifdef PEER_DEBUG
std::cerr << "setting use_extr_addr_finder to " << useExtAddrFinder << std::endl ;
#endif
}
else if (kit->key == kConfigKeyProxyServerIpAddr)
{
proxyIpAddress = kit->value;
#ifdef PEER_DEBUG
std::cerr << "Loaded proxyIpAddress: " << proxyIpAddress;
std::cerr << std::endl ;
#endif
}
else if (kit->key == kConfigKeyProxyServerPort)
{
proxyPort = atoi(kit->value.c_str());
#ifdef PEER_DEBUG
std::cerr << "Loaded proxyPort: " << proxyPort;
std::cerr << std::endl ;
#endif
}
}
@ -1773,16 +1803,22 @@ bool p3PeerMgrIMPL::loadList(std::list<RsItem *>& load)
{
RsStackMutex stack(mPeerMtx); /****** STACK LOCK MUTEX *******/
#ifdef PEER_DEBUG
std::cerr << "Loaded service permission item: " << std::endl;
#endif
for(uint32_t i=0;i<sitem->pgp_ids.size();++i)
if(AuthGPG::getAuthGPG()->isGPGAccepted(sitem->pgp_ids[i]) || sitem->pgp_ids[i] == AuthGPG::getAuthGPG()->getGPGOwnId())
{
mFriendsPermissionFlags[sitem->pgp_ids[i]] = sitem->service_flags[i] ;
#ifdef PEER_DEBUG
std::cerr << " " << sitem->pgp_ids[i] << " - " << sitem->service_flags[i] << std::endl;
#endif
}
#ifdef PEER_DEBUG
else
std::cerr << " " << sitem->pgp_ids[i] << " - Not a friend!" << std::endl;
#endif
}
delete (*it);

View File

@ -952,8 +952,10 @@ int unix_fcntl_nonblock(int fd)
int unix_connect(int fd, const struct sockaddr *serv_addr, socklen_t socklen)
{
#ifdef NET_DEBUG
std::cerr << "unix_connect()";
std::cerr << std::endl;
#endif
const struct sockaddr_storage *ss_addr = (struct sockaddr_storage *) serv_addr;
socklen_t len = socklen;

View File

@ -40,7 +40,7 @@
const int pqisslproxyzone = 3517;
#define PROXY_DEBUG 1
// #define PROXY_DEBUG 1
#define PROXY_STATE_FAILED 0
#define PROXY_STATE_INIT 1
@ -595,7 +595,9 @@ bool pqisslproxy::connect_parameter(uint32_t type, const std::string &value)
rslog(RSL_WARNING, pqisslproxyzone, out);
mDomainAddress = value;
#ifdef PROXY_DEBUG
std::cerr << out << std::endl;
#endif
return true;
}
}
@ -615,7 +617,9 @@ bool pqisslproxy::connect_parameter(uint32_t type, uint32_t value)
rslog(RSL_WARNING, pqisslproxyzone, out);
mRemotePort = value;
#ifdef PROXY_DEBUG
std::cerr << out << std::endl;
#endif
return true;
}
}

View File

@ -127,8 +127,10 @@ RsGenExchange::ServiceCreate_Return p3GxsChannels::service_CreateGroup(RsGxsGrpI
void p3GxsChannels::notifyChanges(std::vector<RsGxsNotify *> &changes)
{
#ifdef GXSCHANNELS_DEBUG
std::cerr << "p3GxsChannels::notifyChanges()";
std::cerr << std::endl;
#endif
p3Notify *notify = NULL;
if (!changes.empty())
@ -165,20 +167,26 @@ void p3GxsChannels::notifyChanges(std::vector<RsGxsNotify *> &changes)
if (!msgChange->metaChange())
{
#ifdef GXSCHANNELS_DEBUG
std::cerr << "p3GxsChannels::notifyChanges() Found Message Change Notification";
std::cerr << std::endl;
#endif
std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > &msgChangeMap = msgChange->msgChangeMap;
std::map<RsGxsGroupId, std::vector<RsGxsMessageId> >::iterator mit;
for(mit = msgChangeMap.begin(); mit != msgChangeMap.end(); ++mit)
{
#ifdef GXSCHANNELS_DEBUG
std::cerr << "p3GxsChannels::notifyChanges() Msgs for Group: " << mit->first;
std::cerr << std::endl;
#endif
if (autoDownloadEnabled(mit->first))
{
#ifdef GXSCHANNELS_DEBUG
std::cerr << "p3GxsChannels::notifyChanges() AutoDownload for Group: " << mit->first;
std::cerr << std::endl;
#endif
/* problem is most of these will be comments and votes,
* should make it occasional - every 5mins / 10minutes TODO */
@ -234,8 +242,10 @@ static time_t last_dummy_tick = 0;
bool p3GxsChannels::getGroupData(const uint32_t &token, std::vector<RsGxsChannelGroup> &groups)
{
#ifdef GXSCHANNELS_DEBUG
std::cerr << "p3GxsChannels::getGroupData()";
std::cerr << std::endl;
#endif
std::vector<RsGxsGrpItem*> grpData;
bool ok = RsGenExchange::getGroupData(token, grpData);
@ -285,8 +295,10 @@ bool p3GxsChannels::groupShareKeys(const RsGxsGroupId &groupId, std::list<RsPeer
bool p3GxsChannels::getPostData(const uint32_t &token, std::vector<RsGxsChannelPost> &msgs)
{
#ifdef GXSCHANNELS_DEBUG
std::cerr << "p3GxsChannels::getPostData()";
std::cerr << std::endl;
#endif
GxsMsgDataMap msgData;
bool ok = RsGenExchange::getMsgData(token, msgData);
@ -332,8 +344,10 @@ bool p3GxsChannels::getPostData(const uint32_t &token, std::vector<RsGxsChannelP
bool p3GxsChannels::getRelatedPosts(const uint32_t &token, std::vector<RsGxsChannelPost> &msgs)
{
#ifdef GXSCHANNELS_DEBUG
std::cerr << "p3GxsChannels::getRelatedPosts()";
std::cerr << std::endl;
#endif
GxsMsgRelatedDataMap msgData;
bool ok = RsGenExchange::getMsgRelatedData(token, msgData);
@ -466,21 +480,27 @@ void p3GxsChannels::load_SubscribedGroups(const uint32_t &token)
GXS_SERV::GROUP_SUBSCRIBE_PUBLISH |
GXS_SERV::GROUP_SUBSCRIBE_SUBSCRIBED ))
{
#ifdef GXSCHANNELS_DEBUG
std::cerr << "p3GxsChannels::load_SubscribedGroups() updating Subscribed Group: " << it->mGroupId;
std::cerr << std::endl;
#endif
updateSubscribedGroup(*it);
if (autoDownloadEnabled(it->mGroupId))
{
#ifdef GXSCHANNELS_DEBUG
std::cerr << "p3GxsChannels::load_SubscribedGroups() remembering AutoDownload Group: " << it->mGroupId;
std::cerr << std::endl;
#endif
groupList.push_back(it->mGroupId);
}
}
else
{
#ifdef GXSCHANNELS_DEBUG
std::cerr << "p3GxsChannels::load_SubscribedGroups() clearing unsubscribed Group: " << it->mGroupId;
std::cerr << std::endl;
#endif
clearUnsubscribedGroup(it->mGroupId);
}
}
@ -493,8 +513,10 @@ void p3GxsChannels::load_SubscribedGroups(const uint32_t &token)
void p3GxsChannels::updateSubscribedGroup(const RsGroupMetaData &group)
{
#ifdef GXSCHANNELS_DEBUG
std::cerr << "p3GxsChannels::updateSubscribedGroup() id: " << group.mGroupId;
std::cerr << std::endl;
#endif
mSubscribedGroups[group.mGroupId] = group;
}
@ -502,8 +524,10 @@ void p3GxsChannels::updateSubscribedGroup(const RsGroupMetaData &group)
void p3GxsChannels::clearUnsubscribedGroup(const RsGxsGroupId &id)
{
#ifdef GXSCHANNELS_DEBUG
std::cerr << "p3GxsChannels::clearUnsubscribedGroup() id: " << id;
std::cerr << std::endl;
#endif
//std::map<RsGxsGroupId, RsGrpMetaData> mSubscribedGroups;
std::map<RsGxsGroupId, RsGroupMetaData>::iterator it;
@ -518,8 +542,10 @@ void p3GxsChannels::clearUnsubscribedGroup(const RsGxsGroupId &id)
bool p3GxsChannels::subscribeToGroup(uint32_t &token, const RsGxsGroupId &groupId, bool subscribe)
{
#ifdef GXSCHANNELS_DEBUG
std::cerr << "p3GxsChannels::subscribedToGroup() id: " << groupId << " subscribe: " << subscribe;
std::cerr << std::endl;
#endif
std::list<RsGxsGroupId> groups;
groups.push_back(groupId);
@ -589,14 +615,18 @@ void p3GxsChannels::request_GroupUnprocessedPosts(const std::list<RsGxsGroupId>
void p3GxsChannels::load_SpecificUnprocessedPosts(const uint32_t &token)
{
#ifdef GXSCHANNELS_DEBUG
std::cerr << "p3GxsChannels::load_SpecificUnprocessedPosts";
std::cerr << std::endl;
#endif
std::vector<RsGxsChannelPost> posts;
if (!getPostData(token, posts))
{
#ifdef GXSCHANNELS_DEBUG
std::cerr << "p3GxsChannels::load_SpecificUnprocessedPosts ERROR";
std::cerr << std::endl;
#endif
return;
}
@ -612,14 +642,18 @@ void p3GxsChannels::load_SpecificUnprocessedPosts(const uint32_t &token)
void p3GxsChannels::load_GroupUnprocessedPosts(const uint32_t &token)
{
#ifdef GXSCHANNELS_DEBUG
std::cerr << "p3GxsChannels::load_GroupUnprocessedPosts";
std::cerr << std::endl;
#endif
std::vector<RsGxsChannelPost> posts;
if (!getPostData(token, posts))
{
#ifdef GXSCHANNELS_DEBUG
std::cerr << "p3GxsChannels::load_GroupUnprocessedPosts ERROR";
std::cerr << std::endl;
#endif
return;
}
@ -633,14 +667,16 @@ void p3GxsChannels::load_GroupUnprocessedPosts(const uint32_t &token)
void p3GxsChannels::handleUnprocessedPost(const RsGxsChannelPost &msg)
{
#ifdef GXSCHANNELS_DEBUG
std::cerr << "p3GxsChannels::handleUnprocessedPost() GroupId: " << msg.mMeta.mGroupId << " MsgId: " << msg.mMeta.mMsgId;
std::cerr << std::endl;
#endif
if (!IS_MSG_UNPROCESSED(msg.mMeta.mMsgStatus))
{
std::cerr << "p3GxsChannels::handleUnprocessedPost() Msg already Processed";
std::cerr << "p3GxsChannels::handleUnprocessedPost() Msg already Processed";
std::cerr << std::endl;
std::cerr << "p3GxsChannels::handleUnprocessedPost() ERROR - this should not happen";
std::cerr << "p3GxsChannels::handleUnprocessedPost() ERROR - this should not happen";
std::cerr << std::endl;
return;
}
@ -650,8 +686,10 @@ void p3GxsChannels::handleUnprocessedPost(const RsGxsChannelPost &msg)
{
#ifdef GXSCHANNELS_DEBUG
std::cerr << "p3GxsChannels::handleUnprocessedPost() AutoDownload Enabled ... handling";
std::cerr << std::endl;
#endif
/* check the date is not too old */
time_t age = time(NULL) - msg.mMeta.mPublishTs;
@ -662,8 +700,10 @@ void p3GxsChannels::handleUnprocessedPost(const RsGxsChannelPost &msg)
// NOTE WE DON'T HANDLE PRIVATE CHANNELS HERE.
// MORE THOUGHT HAS TO GO INTO THAT STUFF.
#ifdef GXSCHANNELS_DEBUG
std::cerr << "p3GxsChannels::handleUnprocessedPost() START DOWNLOAD";
std::cerr << std::endl;
#endif
std::list<RsGxsFile>::const_iterator fit;
for(fit = msg.mFiles.begin(); fit != msg.mFiles.end(); ++fit)
@ -686,11 +726,13 @@ void p3GxsChannels::handleUnprocessedPost(const RsGxsChannelPost &msg)
RsGxsGrpMsgIdPair msgId(msg.mMeta.mGroupId, msg.mMeta.mMsgId);
setMessageProcessedStatus(token, msgId, true);
}
#ifdef GXSCHANNELS_DEBUG
else
{
std::cerr << "p3GxsChannels::handleUnprocessedPost() AutoDownload Disabled ... skipping";
std::cerr << std::endl;
}
#endif
}
@ -732,16 +774,20 @@ void p3GxsChannels::handleResponse(uint32_t token, uint32_t req_type)
bool p3GxsChannels::autoDownloadEnabled(const RsGxsGroupId &id)
{
#ifdef GXSCHANNELS_DEBUG
std::cerr << "p3GxsChannels::autoDownloadEnabled(" << id << ")";
std::cerr << std::endl;
#endif
std::map<RsGxsGroupId, RsGroupMetaData>::iterator it;
it = mSubscribedGroups.find(id);
if (it == mSubscribedGroups.end())
{
#ifdef GXSCHANNELS_DEBUG
std::cerr << "p3GxsChannels::autoDownloadEnabled() No Entry";
std::cerr << std::endl;
#endif
return false;
}
@ -785,16 +831,20 @@ std::string SSGxsChannelGroup::save() const
bool p3GxsChannels::setAutoDownload(const RsGxsGroupId &groupId, bool enabled)
{
#ifdef GXSCHANNELS_DEBUG
std::cerr << "p3GxsChannels::setAutoDownload() id: " << groupId << " enabled: " << enabled;
std::cerr << std::endl;
#endif
std::map<RsGxsGroupId, RsGroupMetaData>::iterator it;
it = mSubscribedGroups.find(groupId);
if (it == mSubscribedGroups.end())
{
#ifdef GXSCHANNELS_DEBUG
std::cerr << "p3GxsChannels::setAutoDownload() Missing Group";
std::cerr << std::endl;
#endif
return false;
}
@ -805,8 +855,10 @@ bool p3GxsChannels::setAutoDownload(const RsGxsGroupId &groupId, bool enabled)
if (enabled == ss.mAutoDownload)
{
/* it should be okay! */
#ifdef GXSCHANNELS_DEBUG
std::cerr << "p3GxsChannels::setAutoDownload() WARNING setting looks okay already";
std::cerr << std::endl;
#endif
}
@ -832,8 +884,10 @@ bool p3GxsChannels::setAutoDownload(const RsGxsGroupId &groupId, bool enabled)
void p3GxsChannels::setMessageProcessedStatus(uint32_t& token, const RsGxsGrpMsgIdPair& msgId, bool processed)
{
#ifdef GXSCHANNELS_DEBUG
std::cerr << "p3GxsChannels::setMessageProcessedStatus()";
std::cerr << std::endl;
#endif
uint32_t mask = GXS_SERV::GXS_MSG_STATUS_UNPROCESSED;
uint32_t status = GXS_SERV::GXS_MSG_STATUS_UNPROCESSED;
@ -846,8 +900,10 @@ void p3GxsChannels::setMessageProcessedStatus(uint32_t& token, const RsGxsGrpMsg
void p3GxsChannels::setMessageReadStatus(uint32_t& token, const RsGxsGrpMsgIdPair& msgId, bool read)
{
#ifdef GXSCHANNELS_DEBUG
std::cerr << "p3GxsChannels::setMessageReadStatus()";
std::cerr << std::endl;
#endif
/* Always remove status unprocessed */
uint32_t mask = GXS_SERV::GXS_MSG_STATUS_GUI_NEW | GXS_SERV::GXS_MSG_STATUS_GUI_UNREAD;
@ -865,7 +921,9 @@ void p3GxsChannels::setMessageReadStatus(uint32_t& token, const RsGxsGrpMsgIdPai
bool p3GxsChannels::createGroup(uint32_t &token, RsGxsChannelGroup &group)
{
#ifdef GXSCHANNELS_DEBUG
std::cerr << "p3GxsChannels::createGroup()" << std::endl;
#endif
RsGxsChannelGroupItem* grpItem = new RsGxsChannelGroupItem();
grpItem->fromChannelGroup(group, true);
@ -877,7 +935,9 @@ bool p3GxsChannels::createGroup(uint32_t &token, RsGxsChannelGroup &group)
bool p3GxsChannels::updateGroup(uint32_t &token, RsGxsChannelGroup &group)
{
#ifdef GXSCHANNELS_DEBUG
std::cerr << "p3GxsChannels::updateGroup()" << std::endl;
#endif
RsGxsChannelGroupItem* grpItem = new RsGxsChannelGroupItem();
grpItem->fromChannelGroup(group, true);
@ -890,8 +950,10 @@ bool p3GxsChannels::updateGroup(uint32_t &token, RsGxsChannelGroup &group)
bool p3GxsChannels::createPost(uint32_t &token, RsGxsChannelPost &msg)
{
#ifdef GXSCHANNELS_DEBUG
std::cerr << "p3GxsChannels::createChannelPost() GroupId: " << msg.mMeta.mGroupId;
std::cerr << std::endl;
#endif
RsGxsChannelPostItem* msgItem = new RsGxsChannelPostItem();
msgItem->fromChannelPost(msg, true);
@ -955,8 +1017,10 @@ bool p3GxsChannels::generateDummyData()
std::string groupName;
rs_sprintf(groupName, "TestChannel_%d", mGenCount);
#ifdef GXSCHANNELS_DEBUG
std::cerr << "p3GxsChannels::generateDummyData() Starting off with Group: " << groupName;
std::cerr << std::endl;
#endif
/* create a new group */
generateGroup(mGenToken, groupName);
@ -973,19 +1037,25 @@ void p3GxsChannels::dummy_tick()
if (mGenActive)
{
#ifdef GXSCHANNELS_DEBUG
std::cerr << "p3GxsChannels::dummyTick() Gen Active";
std::cerr << std::endl;
#endif
uint32_t status = RsGenExchange::getTokenService()->requestStatus(mGenToken);
if (status != RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE)
{
#ifdef GXSCHANNELS_DEBUG
std::cerr << "p3GxsChannels::dummy_tick() Status: " << status;
std::cerr << std::endl;
#endif
if (status == RsTokenService::GXS_REQUEST_V2_STATUS_FAILED)
{
#ifdef GXSCHANNELS_DEBUG
std::cerr << "p3GxsChannels::dummy_tick() generateDummyMsgs() FAILED";
std::cerr << std::endl;
#endif
mGenActive = false;
}
return;
@ -1004,8 +1074,10 @@ void p3GxsChannels::dummy_tick()
return;
}
#ifdef GXSCHANNELS_DEBUG
std::cerr << "p3GxsChannels::dummy_tick() Acknowledged GroupId: " << groupId;
std::cerr << std::endl;
#endif
ChannelDummyRef ref(groupId, emptyId, emptyId);
mGenRefs[mGenCount] = ref;
@ -1022,8 +1094,10 @@ void p3GxsChannels::dummy_tick()
return;
}
#ifdef GXSCHANNELS_DEBUG
std::cerr << "p3GxsChannels::dummy_tick() Acknowledged Post <GroupId: " << msgId.first << ", MsgId: " << msgId.second << ">";
std::cerr << std::endl;
#endif
/* store results for later selection */
@ -1042,8 +1116,10 @@ void p3GxsChannels::dummy_tick()
return;
}
#ifdef GXSCHANNELS_DEBUG
std::cerr << "p3GxsChannels::dummy_tick() Acknowledged Comment <GroupId: " << msgId.first << ", MsgId: " << msgId.second << ">";
std::cerr << std::endl;
#endif
/* store results for later selection */
@ -1062,8 +1138,10 @@ void p3GxsChannels::dummy_tick()
return;
}
#ifdef GXSCHANNELS_DEBUG
std::cerr << "p3GxsChannels::dummy_tick() Acknowledged Vote <GroupId: " << msgId.first << ", MsgId: " << msgId.second << ">";
std::cerr << std::endl;
#endif
/* store results for later selection */
@ -1072,8 +1150,10 @@ void p3GxsChannels::dummy_tick()
}
else
{
#ifdef GXSCHANNELS_DEBUG
std::cerr << "p3GxsChannels::dummy_tick() Finished";
std::cerr << std::endl;
#endif
/* done */
mGenActive = false;
@ -1087,8 +1167,10 @@ void p3GxsChannels::dummy_tick()
std::string groupName;
rs_sprintf(groupName, "TestChannel_%d", mGenCount);
#ifdef GXSCHANNELS_DEBUG
std::cerr << "p3GxsChannels::dummy_tick() Generating Group: " << groupName;
std::cerr << std::endl;
#endif
/* create a new group */
generateGroup(mGenToken, groupName);
@ -1107,11 +1189,13 @@ void p3GxsChannels::dummy_tick()
mGenThreadId = parentId;
}
#ifdef GXSCHANNELS_DEBUG
std::cerr << "p3GxsChannels::dummy_tick() Generating Post ... ";
std::cerr << " GroupId: " << grpId;
std::cerr << " ThreadId: " << mGenThreadId;
std::cerr << " ParentId: " << parentId;
std::cerr << std::endl;
#endif
generatePost(mGenToken, grpId);
}
@ -1129,11 +1213,13 @@ void p3GxsChannels::dummy_tick()
mGenThreadId = parentId;
}
#ifdef GXSCHANNELS_DEBUG
std::cerr << "p3GxsChannels::dummy_tick() Generating Comment ... ";
std::cerr << " GroupId: " << grpId;
std::cerr << " ThreadId: " << mGenThreadId;
std::cerr << " ParentId: " << parentId;
std::cerr << std::endl;
#endif
generateComment(mGenToken, grpId, parentId, mGenThreadId);
}
@ -1151,11 +1237,13 @@ void p3GxsChannels::dummy_tick()
mGenThreadId = parentId;
}
#ifdef GXSCHANNELS_DEBUG
std::cerr << "p3GxsChannels::dummy_tick() Generating Vote ... ";
std::cerr << " GroupId: " << grpId;
std::cerr << " ThreadId: " << mGenThreadId;
std::cerr << " ParentId: " << parentId;
std::cerr << std::endl;
#endif
generateVote(mGenToken, grpId, parentId, mGenThreadId);
}
@ -1216,15 +1304,19 @@ bool p3GxsChannels::generateComment(uint32_t &token, const RsGxsGroupId &grpId,
if (it != ownIds.end())
{
#ifdef GXSCHANNELS_DEBUG
std::cerr << "p3GxsChannels::generateComment() Author: " << *it;
std::cerr << std::endl;
#endif
msg.mMeta.mAuthorId = *it;
}
#ifdef GXSCHANNELS_DEBUG
else
{
std::cerr << "p3GxsChannels::generateComment() No Author!";
std::cerr << std::endl;
}
#endif
createComment(token, msg);
@ -1253,15 +1345,19 @@ bool p3GxsChannels::generateVote(uint32_t &token, const RsGxsGroupId &grpId, con
if (it != ownIds.end())
{
#ifdef GXSCHANNELS_DEBUG
std::cerr << "p3GxsChannels::generateVote() Author: " << *it;
std::cerr << std::endl;
#endif
vote.mMeta.mAuthorId = *it;
}
#ifdef GXSCHANNELS_DEBUG
else
{
std::cerr << "p3GxsChannels::generateVote() No Author!";
std::cerr << std::endl;
}
#endif
if (0.7 > RSRandom::random_f32())
{
@ -1294,8 +1390,10 @@ bool p3GxsChannels::generateGroup(uint32_t &token, std::string groupName)
// Overloaded from RsTickEvent for Event callbacks.
void p3GxsChannels::handle_event(uint32_t event_type, const std::string &elabel)
{
#ifdef GXSCHANNELS_DEBUG
std::cerr << "p3GxsChannels::handle_event(" << event_type << ")";
std::cerr << std::endl;
#endif
// stuff.
switch(event_type)

View File

@ -86,8 +86,10 @@ uint32_t p3PostBase::postBaseAuthenPolicy()
void p3PostBase::notifyChanges(std::vector<RsGxsNotify *> &changes)
{
#ifdef POSTBASE_DEBUG
std::cerr << "p3PostBase::notifyChanges()";
std::cerr << std::endl;
#endif
p3Notify *notify = NULL;
if (!changes.empty())
@ -103,15 +105,19 @@ void p3PostBase::notifyChanges(std::vector<RsGxsNotify *> &changes)
RsGxsMsgChange *msgChange = dynamic_cast<RsGxsMsgChange *>(*it);
if (msgChange)
{
#ifdef POSTBASE_DEBUG
std::cerr << "p3PostBase::notifyChanges() Found Message Change Notification";
std::cerr << std::endl;
#endif
std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > &msgChangeMap = msgChange->msgChangeMap;
std::map<RsGxsGroupId, std::vector<RsGxsMessageId> >::iterator mit;
for(mit = msgChangeMap.begin(); mit != msgChangeMap.end(); ++mit)
{
#ifdef POSTBASE_DEBUG
std::cerr << "p3PostBase::notifyChanges() Msgs for Group: " << mit->first;
std::cerr << std::endl;
#endif
// To start with we are just going to trigger updates on these groups.
// FUTURE OPTIMISATION.
// It could be taken a step further and directly request these msgs for an update.
@ -131,15 +137,19 @@ void p3PostBase::notifyChanges(std::vector<RsGxsNotify *> &changes)
/* pass on Group Changes to GUI */
if (groupChange)
{
#ifdef POSTBASE_DEBUG
std::cerr << "p3PostBase::notifyChanges() Found Group Change Notification";
std::cerr << std::endl;
#endif
std::list<RsGxsGroupId> &groupList = groupChange->mGrpIdList;
std::list<RsGxsGroupId>::iterator git;
for(git = groupList.begin(); git != groupList.end(); ++git)
{
#ifdef POSTBASE_DEBUG
std::cerr << "p3PostBase::notifyChanges() Incoming Group: " << *git;
std::cerr << std::endl;
#endif
if (notify && groupChange->getType() == RsGxsNotify::TYPE_RECEIVE)
{
@ -150,8 +160,10 @@ void p3PostBase::notifyChanges(std::vector<RsGxsNotify *> &changes)
}
receiveHelperChanges(changes);
#ifdef POSTBASE_DEBUG
std::cerr << "p3PostBase::notifyChanges() -> receiveChanges()";
std::cerr << std::endl;
#endif
}
void p3PostBase::service_tick()
@ -184,8 +196,10 @@ void p3PostBase::setMessageReadStatus(uint32_t& token, const RsGxsGrpMsgIdPair&
// Overloaded from RsTickEvent for Event callbacks.
void p3PostBase::handle_event(uint32_t event_type, const std::string & /* elabel */)
{
#ifdef POSTBASE_DEBUG
std::cerr << "p3PostBase::handle_event(" << event_type << ")";
std::cerr << std::endl;
#endif
// stuff.
switch(event_type)
@ -196,8 +210,10 @@ void p3PostBase::handle_event(uint32_t event_type, const std::string & /* elabel
default:
/* error */
#ifdef POSTBASE_DEBUG
std::cerr << "p3PostBase::handle_event() Unknown Event Type: " << event_type;
std::cerr << std::endl;
#endif
break;
}
}
@ -236,8 +252,10 @@ void p3PostBase::background_tick()
bool p3PostBase::background_requestAllGroups()
{
#ifdef POSTBASE_DEBUG
std::cerr << "p3PostBase::background_requestAllGroups()";
std::cerr << std::endl;
#endif
uint32_t ansType = RS_TOKREQ_ANSTYPE_LIST;
RsTokReqOptions opts;
@ -254,8 +272,10 @@ bool p3PostBase::background_requestAllGroups()
void p3PostBase::background_loadGroups(const uint32_t &token)
{
/* get messages */
#ifdef POSTBASE_DEBUG
std::cerr << "p3PostBase::background_loadGroups()";
std::cerr << std::endl;
#endif
std::list<RsGxsGroupId> groupList;
bool ok = RsGenExchange::getGroupList(token, groupList);