mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-25 15:39:27 -05:00
fixed some leaking memory issues in loadList() methods, and also increased consistency by not returning non empty list with deleted items inside
This commit is contained in:
parent
48750cdb51
commit
8a41554754
@ -1199,6 +1199,7 @@ bool p3ChatService::loadList(std::list<RsItem*>& load)
|
||||
delete *it;
|
||||
}
|
||||
|
||||
load.clear() ;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -1052,6 +1052,7 @@ bool CacheStrapper::loadList(std::list<RsItem *>& load)
|
||||
delete (*it);
|
||||
}
|
||||
}
|
||||
load.clear() ;
|
||||
|
||||
/* assemble a list of dirs to clean (union of cache dirs) */
|
||||
std::list<std::string> cacheDirs;
|
||||
|
@ -279,6 +279,11 @@ bool p3BitDht::loadList(std::list<RsItem *>& load)
|
||||
/* error */
|
||||
std::cerr << "p3BitDht::loadList() Error only expecting 1 item";
|
||||
std::cerr << std::endl;
|
||||
|
||||
for(std::list<RsItem*>::iterator it=load.begin();it!=load.end();++it)
|
||||
delete *it ;
|
||||
|
||||
load.clear() ;
|
||||
return false;
|
||||
}
|
||||
RsItem *item = load.front();
|
||||
@ -290,6 +295,7 @@ bool p3BitDht::loadList(std::list<RsItem *>& load)
|
||||
/* error */
|
||||
std::cerr << "p3BitDht::loadList() Error expecting item = config";
|
||||
std::cerr << std::endl;
|
||||
delete item ;
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -393,6 +399,7 @@ bool p3BitDht::loadList(std::list<RsItem *>& load)
|
||||
setRelayMode(mode);
|
||||
}
|
||||
|
||||
load.clear() ;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -2224,6 +2224,7 @@ bool ftController::loadList(std::list<RsItem *>& load)
|
||||
/* cleanup */
|
||||
delete (*it);
|
||||
}
|
||||
load.clear() ;
|
||||
return true;
|
||||
|
||||
}
|
||||
|
@ -328,6 +328,8 @@ bool ftFiMonitor::loadList(std::list<RsItem *>& load)
|
||||
if(sscanf(mit->second.c_str(),"%d",&t) == 1)
|
||||
setWatchPeriod(t);
|
||||
}
|
||||
delete *it ;
|
||||
continue ;
|
||||
}
|
||||
|
||||
RsFileConfigItem *fi = dynamic_cast<RsFileConfigItem *>(*it);
|
||||
@ -348,10 +350,13 @@ bool ftFiMonitor::loadList(std::list<RsItem *>& load)
|
||||
info.shareflags &= ~DIR_FLAGS_NETWORK_WIDE_GROUPS ; // disabling this flag for know, for consistency reasons
|
||||
|
||||
dirList.push_back(info) ;
|
||||
|
||||
delete *it ;
|
||||
}
|
||||
|
||||
/* set directories */
|
||||
setSharedDirectories(dirList);
|
||||
load.clear() ;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -484,6 +484,7 @@ bool ftExtraList::loadList(std::list<RsItem *>& load)
|
||||
/********************************** WINDOWS/UNIX SPECIFIC PART ******************/
|
||||
|
||||
}
|
||||
load.clear() ;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -2095,6 +2095,7 @@ bool p3GRouter::loadList(std::list<RsItem*>& items)
|
||||
#ifdef GROUTER_DEBUG
|
||||
debugDump();
|
||||
#endif
|
||||
items.clear() ;
|
||||
return true ;
|
||||
}
|
||||
bool p3GRouter::saveList(bool& cleanup,std::list<RsItem*>& items)
|
||||
|
@ -310,6 +310,18 @@ RsGxsNetService::~RsGxsNetService()
|
||||
it->second.clear() ;
|
||||
}
|
||||
mTransactions.clear() ;
|
||||
|
||||
delete mGrpServerUpdateItem ;
|
||||
|
||||
for(ClientGrpMap::iterator it = mClientGrpUpdateMap.begin();it!=mClientGrpUpdateMap.end();++it)
|
||||
delete it->second ;
|
||||
|
||||
mClientGrpUpdateMap.clear() ;
|
||||
|
||||
for(std::map<RsGxsGroupId, RsGxsServerMsgUpdateItem*>::iterator it(mServerMsgUpdateMap.begin());it!=mServerMsgUpdateMap.end();)
|
||||
delete it->second ;
|
||||
|
||||
mServerMsgUpdateMap.clear() ;
|
||||
}
|
||||
|
||||
|
||||
@ -1310,9 +1322,7 @@ public:
|
||||
else if((gsui = dynamic_cast<RsGxsServerGrpUpdateItem*>(item)) != NULL)
|
||||
{
|
||||
if(mServerGrpUpdateItem == NULL)
|
||||
{
|
||||
mServerGrpUpdateItem = gsui;
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cerr << "Error! More than one server group update item exists!" << std::endl;
|
||||
@ -1320,7 +1330,10 @@ public:
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cerr << "Type not expected!" << std::endl;
|
||||
delete item ;
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
@ -1336,6 +1349,8 @@ bool RsGxsNetService::loadList(std::list<RsItem *> &load)
|
||||
{
|
||||
RS_STACK_MUTEX(mNxsMutex) ;
|
||||
|
||||
// The delete is done in StoreHere, if necessary
|
||||
|
||||
std::for_each(load.begin(), load.end(), StoreHere(mClientGrpUpdateMap, mClientMsgUpdateMap, mServerMsgUpdateMap, mGrpServerUpdateItem));
|
||||
time_t now = time(NULL);
|
||||
|
||||
|
@ -20,8 +20,8 @@ class RsCacheService: public CacheSource, public CacheStore, public p3Config
|
||||
// Functions from p3config
|
||||
//
|
||||
virtual RsSerialiser *setupSerialiser() { return NULL ; }
|
||||
virtual bool saveList(bool&, std::list<RsItem*>&) { return false ;}
|
||||
virtual bool loadList(std::list<RsItem*>&) { return false ;}
|
||||
virtual bool saveList(bool&, std::list<RsItem*>&) =0;
|
||||
virtual bool loadList(std::list<RsItem*>&) =0;
|
||||
|
||||
private:
|
||||
uint32_t _tick_delay_in_seconds ;
|
||||
|
@ -17,8 +17,8 @@ class RsPQIService: public p3Service, public p3Config
|
||||
// Functions from p3config
|
||||
//
|
||||
virtual RsSerialiser *setupSerialiser() { return NULL ; }
|
||||
virtual bool saveList(bool&, std::list<RsItem*>&) { return false ;}
|
||||
virtual bool loadList(std::list<RsItem*>&) { return false ;}
|
||||
virtual bool saveList(bool&, std::list<RsItem*>&) =0 ;
|
||||
virtual bool loadList(std::list<RsItem*>&) =0 ;
|
||||
|
||||
private:
|
||||
uint32_t _tick_delay_in_seconds ;
|
||||
|
@ -715,6 +715,7 @@ bool AuthGPG::loadList(std::list<RsItem*>& load)
|
||||
}
|
||||
delete (*it);
|
||||
}
|
||||
load.clear() ;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -1705,6 +1705,7 @@ bool AuthSSLimpl::loadList(std::list<RsItem*>& load)
|
||||
}
|
||||
delete (*it);
|
||||
}
|
||||
load.clear() ;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -307,7 +307,8 @@ bool p3HistoryMgr::loadList(std::list<RsItem*>& load)
|
||||
RsHistoryMsgItem *msgItem;
|
||||
std::list<RsItem*>::iterator it;
|
||||
|
||||
for (it = load.begin(); it != load.end(); ++it) {
|
||||
for (it = load.begin(); it != load.end(); ++it)
|
||||
{
|
||||
if (NULL != (msgItem = dynamic_cast<RsHistoryMsgItem*>(*it))) {
|
||||
|
||||
std::map<RsPeerId, std::map<uint32_t, RsHistoryMsgItem*> >::iterator mit = mMessages.find(msgItem->chatPeerId);
|
||||
@ -381,6 +382,7 @@ bool p3HistoryMgr::loadList(std::list<RsItem*>& load)
|
||||
delete (*it);
|
||||
}
|
||||
|
||||
load.clear() ;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -2360,6 +2360,7 @@ bool p3PeerMgrIMPL::loadList(std::list<RsItem *>& load)
|
||||
setProxyServerAddress(RS_HIDDEN_TYPE_I2P, proxy_addr);
|
||||
}
|
||||
|
||||
load.clear() ;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -1180,12 +1180,13 @@ bool p3ServiceControl::loadList(std::list<RsItem *>& loadList)
|
||||
{
|
||||
RsServicePermissionItem *item = dynamic_cast<RsServicePermissionItem*>(*it) ;
|
||||
|
||||
if(item == NULL)
|
||||
continue ;
|
||||
if(item != NULL)
|
||||
mServicePermissionMap[item->mServiceId] = *item ;
|
||||
|
||||
mServicePermissionMap[item->mServiceId] = *item ;
|
||||
delete *it ;
|
||||
}
|
||||
|
||||
loadList.clear() ;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -885,6 +885,7 @@ bool p3BanList::loadList(std::list<RsItem*>& load)
|
||||
delete *it ;
|
||||
}
|
||||
|
||||
load.clear() ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
|
@ -793,6 +793,7 @@ bool p3GxsReputation::loadList(std::list<RsItem *>& loadList)
|
||||
delete (*it);
|
||||
}
|
||||
|
||||
loadList.clear() ;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -275,6 +275,7 @@ bool p3IdService::loadList(std::list<RsItem*>& items)
|
||||
RsGxsIdLocalInfoItem *lii;
|
||||
|
||||
for(std::list<RsItem*>::const_iterator it = items.begin();it!=items.end();++it)
|
||||
{
|
||||
if( (lii = dynamic_cast<RsGxsIdLocalInfoItem*>(*it)) != NULL)
|
||||
{
|
||||
for(std::map<RsGxsId,time_t>::const_iterator it2 = lii->mTimeStamps.begin();it2!=lii->mTimeStamps.end();++it2)
|
||||
@ -283,6 +284,10 @@ bool p3IdService::loadList(std::list<RsItem*>& items)
|
||||
mContacts = lii->mContacts ;
|
||||
}
|
||||
|
||||
delete *it ;
|
||||
}
|
||||
|
||||
items.clear() ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
|
@ -544,7 +544,7 @@ bool p3MsgService::loadList(std::list<RsItem*>& load)
|
||||
RsMsgSrcId* msi;
|
||||
RsMsgParentId* msp;
|
||||
RsMsgGRouterMap* grm;
|
||||
// RsPublicMsgInviteConfigItem* msv;
|
||||
// RsPublicMsgInviteConfigItem* msv;
|
||||
|
||||
std::list<RsMsgItem*> items;
|
||||
std::list<RsItem*>::iterator it;
|
||||
@ -552,150 +552,155 @@ bool p3MsgService::loadList(std::list<RsItem*>& load)
|
||||
std::map<uint32_t, RsPeerId> srcIdMsgMap;
|
||||
std::map<uint32_t, RsPeerId>::iterator srcIt;
|
||||
|
||||
// load items and calculate next unique msgId
|
||||
for(it = load.begin(); it != load.end(); ++it)
|
||||
{
|
||||
// load items and calculate next unique msgId
|
||||
for(it = load.begin(); it != load.end(); ++it)
|
||||
{
|
||||
|
||||
if (NULL != (mitem = dynamic_cast<RsMsgItem *>(*it)))
|
||||
{
|
||||
/* STORE MsgID */
|
||||
if (mitem->msgId >= mMsgUniqueId) {
|
||||
mMsgUniqueId = mitem->msgId + 1;
|
||||
}
|
||||
items.push_back(mitem);
|
||||
}
|
||||
else if (NULL != (grm = dynamic_cast<RsMsgGRouterMap *>(*it)))
|
||||
{
|
||||
// merge.
|
||||
for(std::map<GRouterMsgPropagationId,uint32_t>::const_iterator it(grm->ongoing_msgs.begin());it!=grm->ongoing_msgs.end();++it)
|
||||
_ongoing_messages.insert(*it) ;
|
||||
}
|
||||
else if(NULL != (mtt = dynamic_cast<RsMsgTagType *>(*it)))
|
||||
{
|
||||
// delete standard tags as they are now save in config
|
||||
if(mTags.end() == (tagIt = mTags.find(mtt->tagId)))
|
||||
{
|
||||
mTags.insert(std::pair<uint32_t, RsMsgTagType* >(mtt->tagId, mtt));
|
||||
}
|
||||
else
|
||||
{
|
||||
delete mTags[mtt->tagId];
|
||||
mTags.erase(tagIt);
|
||||
mTags.insert(std::pair<uint32_t, RsMsgTagType* >(mtt->tagId, mtt));
|
||||
}
|
||||
if (NULL != (mitem = dynamic_cast<RsMsgItem *>(*it)))
|
||||
{
|
||||
/* STORE MsgID */
|
||||
if (mitem->msgId >= mMsgUniqueId) {
|
||||
mMsgUniqueId = mitem->msgId + 1;
|
||||
}
|
||||
items.push_back(mitem);
|
||||
}
|
||||
else if (NULL != (grm = dynamic_cast<RsMsgGRouterMap *>(*it)))
|
||||
{
|
||||
// merge.
|
||||
for(std::map<GRouterMsgPropagationId,uint32_t>::const_iterator it(grm->ongoing_msgs.begin());it!=grm->ongoing_msgs.end();++it)
|
||||
_ongoing_messages.insert(*it) ;
|
||||
}
|
||||
else if(NULL != (mtt = dynamic_cast<RsMsgTagType *>(*it)))
|
||||
{
|
||||
// delete standard tags as they are now save in config
|
||||
if(mTags.end() == (tagIt = mTags.find(mtt->tagId)))
|
||||
{
|
||||
mTags.insert(std::pair<uint32_t, RsMsgTagType* >(mtt->tagId, mtt));
|
||||
}
|
||||
else
|
||||
{
|
||||
delete mTags[mtt->tagId];
|
||||
mTags.erase(tagIt);
|
||||
mTags.insert(std::pair<uint32_t, RsMsgTagType* >(mtt->tagId, mtt));
|
||||
}
|
||||
|
||||
}
|
||||
else if(NULL != (mti = dynamic_cast<RsMsgTags *>(*it)))
|
||||
{
|
||||
mMsgTags.insert(std::pair<uint32_t, RsMsgTags* >(mti->msgId, mti));
|
||||
}
|
||||
else if(NULL != (msi = dynamic_cast<RsMsgSrcId *>(*it)))
|
||||
{
|
||||
srcIdMsgMap.insert(std::pair<uint32_t, RsPeerId>(msi->msgId, msi->srcId));
|
||||
mSrcIds.insert(std::pair<uint32_t, RsMsgSrcId*>(msi->msgId, msi)); // does not need to be kept
|
||||
}
|
||||
else if(NULL != (msp = dynamic_cast<RsMsgParentId *>(*it)))
|
||||
{
|
||||
mParentId.insert(std::pair<uint32_t, RsMsgParentId*>(msp->msgId, msp));
|
||||
}
|
||||
}
|
||||
else if(NULL != (mti = dynamic_cast<RsMsgTags *>(*it)))
|
||||
{
|
||||
mMsgTags.insert(std::pair<uint32_t, RsMsgTags* >(mti->msgId, mti));
|
||||
}
|
||||
else if(NULL != (msi = dynamic_cast<RsMsgSrcId *>(*it)))
|
||||
{
|
||||
srcIdMsgMap.insert(std::pair<uint32_t, RsPeerId>(msi->msgId, msi->srcId));
|
||||
mSrcIds.insert(std::pair<uint32_t, RsMsgSrcId*>(msi->msgId, msi)); // does not need to be kept
|
||||
}
|
||||
else if(NULL != (msp = dynamic_cast<RsMsgParentId *>(*it)))
|
||||
{
|
||||
mParentId.insert(std::pair<uint32_t, RsMsgParentId*>(msp->msgId, msp));
|
||||
}
|
||||
|
||||
RsConfigKeyValueSet *vitem = NULL ;
|
||||
RsConfigKeyValueSet *vitem = NULL ;
|
||||
|
||||
if(NULL != (vitem = dynamic_cast<RsConfigKeyValueSet*>(*it)))
|
||||
for(std::list<RsTlvKeyValue>::const_iterator kit = vitem->tlvkvs.pairs.begin(); kit != vitem->tlvkvs.pairs.end(); ++kit)
|
||||
{
|
||||
if(kit->key == "DISTANT_MESSAGES_ENABLED")
|
||||
{
|
||||
if(NULL != (vitem = dynamic_cast<RsConfigKeyValueSet*>(*it)))
|
||||
{
|
||||
for(std::list<RsTlvKeyValue>::const_iterator kit = vitem->tlvkvs.pairs.begin(); kit != vitem->tlvkvs.pairs.end(); ++kit)
|
||||
{
|
||||
if(kit->key == "DISTANT_MESSAGES_ENABLED")
|
||||
{
|
||||
#ifdef MSG_DEBUG
|
||||
std::cerr << "Loaded config default nick name for distant chat: " << kit->value << std::endl ;
|
||||
std::cerr << "Loaded config default nick name for distant chat: " << kit->value << std::endl ;
|
||||
#endif
|
||||
mShouldEnableDistantMessaging = (kit->value == "YES") ;
|
||||
}
|
||||
if(kit->key == "DISTANT_MESSAGE_PERMISSION_FLAGS")
|
||||
{
|
||||
mShouldEnableDistantMessaging = (kit->value == "YES") ;
|
||||
}
|
||||
if(kit->key == "DISTANT_MESSAGE_PERMISSION_FLAGS")
|
||||
{
|
||||
#ifdef MSG_DEBUG
|
||||
std::cerr << "Loaded distant message permission flags: " << kit->value << std::endl ;
|
||||
std::cerr << "Loaded distant message permission flags: " << kit->value << std::endl ;
|
||||
#endif
|
||||
if (!kit->value.empty())
|
||||
{
|
||||
std::istringstream is(kit->value) ;
|
||||
if (!kit->value.empty())
|
||||
{
|
||||
std::istringstream is(kit->value) ;
|
||||
|
||||
uint32_t tmp ;
|
||||
is >> tmp ;
|
||||
uint32_t tmp ;
|
||||
is >> tmp ;
|
||||
|
||||
if(tmp < 3)
|
||||
mDistantMessagePermissions = tmp ;
|
||||
else
|
||||
std::cerr << "(EE) Invalid value read for DistantMessagePermission flags in config: " << tmp << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(tmp < 3)
|
||||
mDistantMessagePermissions = tmp ;
|
||||
else
|
||||
std::cerr << "(EE) Invalid value read for DistantMessagePermission flags in config: " << tmp << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
delete *it ;
|
||||
continue ;
|
||||
}
|
||||
}
|
||||
load.clear() ;
|
||||
|
||||
// sort items into lists
|
||||
std::list<RsMsgItem*>::iterator msgIt;
|
||||
for (msgIt = items.begin(); msgIt != items.end(); ++msgIt)
|
||||
{
|
||||
mitem = *msgIt;
|
||||
// sort items into lists
|
||||
std::list<RsMsgItem*>::iterator msgIt;
|
||||
for (msgIt = items.begin(); msgIt != items.end(); ++msgIt)
|
||||
{
|
||||
mitem = *msgIt;
|
||||
|
||||
/* STORE MsgID */
|
||||
if (mitem->msgId == 0) {
|
||||
/* STORE MsgID */
|
||||
if (mitem->msgId == 0) {
|
||||
mitem->msgId = getNewUniqueMsgId();
|
||||
}
|
||||
}
|
||||
|
||||
RsStackMutex stack(mMsgMtx); /********** STACK LOCKED MTX ******/
|
||||
RsStackMutex stack(mMsgMtx); /********** STACK LOCKED MTX ******/
|
||||
|
||||
srcIt = srcIdMsgMap.find(mitem->msgId);
|
||||
if(srcIt != srcIdMsgMap.end()) {
|
||||
mitem->PeerId(srcIt->second);
|
||||
srcIdMsgMap.erase(srcIt);
|
||||
}
|
||||
srcIt = srcIdMsgMap.find(mitem->msgId);
|
||||
if(srcIt != srcIdMsgMap.end()) {
|
||||
mitem->PeerId(srcIt->second);
|
||||
srcIdMsgMap.erase(srcIt);
|
||||
}
|
||||
|
||||
/* switch depending on the PENDING
|
||||
/* switch depending on the PENDING
|
||||
* flags
|
||||
*/
|
||||
if (mitem -> msgFlags & RS_MSG_FLAGS_PENDING)
|
||||
{
|
||||
if (mitem -> msgFlags & RS_MSG_FLAGS_PENDING)
|
||||
{
|
||||
|
||||
//std::cerr << "MSG_PENDING";
|
||||
//std::cerr << std::endl;
|
||||
//mitem->print(std::cerr);
|
||||
//std::cerr << "MSG_PENDING";
|
||||
//std::cerr << std::endl;
|
||||
//mitem->print(std::cerr);
|
||||
|
||||
msgOutgoing[mitem->msgId] = mitem;
|
||||
}
|
||||
else
|
||||
{
|
||||
imsg[mitem->msgId] = mitem;
|
||||
}
|
||||
}
|
||||
msgOutgoing[mitem->msgId] = mitem;
|
||||
}
|
||||
else
|
||||
{
|
||||
imsg[mitem->msgId] = mitem;
|
||||
}
|
||||
}
|
||||
|
||||
RsStackMutex stack(mMsgMtx); /********** STACK LOCKED MTX ******/
|
||||
RsStackMutex stack(mMsgMtx); /********** STACK LOCKED MTX ******/
|
||||
|
||||
/* remove missing msgId in mSrcIds */
|
||||
for (srcIt = srcIdMsgMap.begin(); srcIt != srcIdMsgMap.end(); ++srcIt) {
|
||||
std::map<uint32_t, RsMsgSrcId*>::iterator it = mSrcIds.find(srcIt->first);
|
||||
if (it != mSrcIds.end()) {
|
||||
delete(it->second);
|
||||
mSrcIds.erase(it);
|
||||
}
|
||||
}
|
||||
/* remove missing msgId in mSrcIds */
|
||||
for (srcIt = srcIdMsgMap.begin(); srcIt != srcIdMsgMap.end(); ++srcIt) {
|
||||
std::map<uint32_t, RsMsgSrcId*>::iterator it = mSrcIds.find(srcIt->first);
|
||||
if (it != mSrcIds.end()) {
|
||||
delete(it->second);
|
||||
mSrcIds.erase(it);
|
||||
}
|
||||
}
|
||||
|
||||
/* remove missing msgId in mParentId */
|
||||
std::map<uint32_t, RsMsgParentId *>::iterator mit = mParentId.begin();
|
||||
while (mit != mParentId.end()) {
|
||||
if (imsg.find(mit->first) == imsg.end()) {
|
||||
if (msgOutgoing.find(mit->first) == msgOutgoing.end()) {
|
||||
/* not found */
|
||||
mParentId.erase(mit++);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
/* remove missing msgId in mParentId */
|
||||
std::map<uint32_t, RsMsgParentId *>::iterator mit = mParentId.begin();
|
||||
while (mit != mParentId.end()) {
|
||||
if (imsg.find(mit->first) == imsg.end()) {
|
||||
if (msgOutgoing.find(mit->first) == msgOutgoing.end()) {
|
||||
/* not found */
|
||||
mParentId.erase(mit++);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
++mit;
|
||||
}
|
||||
++mit;
|
||||
}
|
||||
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
|
||||
void p3MsgService::loadWelcomeMsg()
|
||||
|
@ -309,42 +309,34 @@ bool p3StatusService::saveList(bool& cleanup, std::list<RsItem*>& ilist){
|
||||
return true;
|
||||
}
|
||||
|
||||
bool p3StatusService::loadList(std::list<RsItem*>& load){
|
||||
|
||||
// load your status from last rs session
|
||||
StatusInfo own_info;
|
||||
std::list<RsItem*>::const_iterator it = load.begin();
|
||||
|
||||
if(it == load.end()){
|
||||
std::cerr << "p3StatusService::loadList(): Failed to load " << std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
for(; it != load.end(); ++it){
|
||||
RsStatusItem* own_status = dynamic_cast<RsStatusItem* >(*it);
|
||||
bool p3StatusService::loadList(std::list<RsItem*>& load)
|
||||
{
|
||||
// load your status from last rs session
|
||||
StatusInfo own_info;
|
||||
|
||||
|
||||
if(own_status != NULL){
|
||||
for(std::list<RsItem*>::const_iterator it = load.begin() ; it != load.end(); ++it)
|
||||
{
|
||||
RsStatusItem* own_status = dynamic_cast<RsStatusItem* >(*it);
|
||||
|
||||
own_info.id = mServiceCtrl->getOwnId();
|
||||
own_info.status = own_status->status;
|
||||
own_info.time_stamp = own_status->sendTime;
|
||||
delete own_status;
|
||||
if(own_status != NULL)
|
||||
{
|
||||
own_info.id = mServiceCtrl->getOwnId();
|
||||
own_info.status = own_status->status;
|
||||
own_info.time_stamp = own_status->sendTime;
|
||||
|
||||
{
|
||||
RsStackMutex stack(mStatusMtx);
|
||||
std::pair<RsPeerId, StatusInfo> pr(mServiceCtrl->getOwnId(), own_info);
|
||||
mStatusInfoMap.insert(pr);
|
||||
}
|
||||
{
|
||||
RsStackMutex stack(mStatusMtx);
|
||||
std::pair<RsPeerId, StatusInfo> pr(mServiceCtrl->getOwnId(), own_info);
|
||||
mStatusInfoMap.insert(pr);
|
||||
}
|
||||
|
||||
return true;
|
||||
}else{
|
||||
std::cerr << "p3StatusService::loadList " << "Failed to load list "
|
||||
<< std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return false;
|
||||
delete *it ;
|
||||
}
|
||||
load.clear() ;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
@ -728,6 +728,7 @@ bool p3turtle::loadList(std::list<RsItem*>& load)
|
||||
|
||||
delete vitem ;
|
||||
}
|
||||
load.clear() ;
|
||||
return true ;
|
||||
}
|
||||
int p3turtle::getMaxTRForwardRate() const
|
||||
|
@ -784,6 +784,7 @@ bool p3VOIP::loadList(std::list<RsItem*>& load)
|
||||
delete vitem ;
|
||||
}
|
||||
|
||||
load.clear() ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user