Switched most of the services to use p3ServiceControl instead of p3LinkMgr.

- Added a couple of utility fns to p3ServiceControl too.



git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@7211 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
drbob 2014-03-29 03:57:44 +00:00
parent efe9503c3a
commit 190988c3cc
33 changed files with 387 additions and 329 deletions

View file

@ -25,6 +25,7 @@
#include "pqi/p3linkmgr.h"
#include "pqi/p3netmgr.h"
#include "pqi/pqipersongrp.h"
#include "util/rsnet.h"
@ -311,38 +312,35 @@ int p3BandwidthControl::printRateInfo_locked(std::ostream &out)
}
/*************** pqiMonitor callback ***********************/
void p3BandwidthControl::statusChange(const std::list<pqipeer> &plist)
void p3BandwidthControl::statusChange(const std::list<pqiServicePeer> &plist)
{
std::list<pqipeer>::const_iterator it;
std::list<pqiServicePeer>::const_iterator it;
for (it = plist.begin(); it != plist.end(); it++)
{
if (it->state & RS_PEER_S_FRIEND)
{
RsStackMutex stack(mBwMtx); /****** LOCKED MUTEX *******/
RsStackMutex stack(mBwMtx); /****** LOCKED MUTEX *******/
if (it->actions & RS_PEER_DISCONNECTED)
if (it->actions & RS_SERVICE_PEER_DISCONNECTED)
{
/* remove from map */
std::map<RsPeerId, BwCtrlData>::iterator bit;
bit = mBwMap.find(it->id);
if (bit == mBwMap.end())
{
/* remove from map */
std::map<RsPeerId, BwCtrlData>::iterator bit;
bit = mBwMap.find(it->id);
if (bit == mBwMap.end())
{
std::cerr << "p3BandwidthControl::statusChange() ERROR";
std::cerr << " Entry not in map";
std::cerr << std::endl;
}
else
{
mBwMap.erase(bit);
}
std::cerr << "p3BandwidthControl::statusChange() ERROR";
std::cerr << " Entry not in map";
std::cerr << std::endl;
}
else if (it->actions & RS_PEER_CONNECTED)
else
{
/* stuff */
BwCtrlData data;
mBwMap[it->id] = data;
mBwMap.erase(bit);
}
}
else if (it->actions & RS_SERVICE_PEER_CONNECTED)
{
/* stuff */
BwCtrlData data;
mBwMap[it->id] = data;
}
}
return;
}