mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-08-14 00:55:46 -04:00
Added some optimizations (const std::string&) to the load of the caches at startup and to the p3ConnectMgr.
Added PRE_TARGETDEPS in RetroShare.pro for Windows too. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3923 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
d4393b8d0b
commit
35f91f5e07
10 changed files with 69 additions and 68 deletions
libretroshare/src/pqi
|
@ -1498,7 +1498,7 @@ bool p3ConnectMgr::getOwnNetStatus(peerConnectState &state)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool p3ConnectMgr::isFriend(std::string id)
|
||||
bool p3ConnectMgr::isFriend(const std::string &id)
|
||||
{
|
||||
#ifdef CONN_DEBUG
|
||||
std::cerr << "p3ConnectMgr::isFriend(" << id << ") called" << std::endl;
|
||||
|
@ -1511,7 +1511,7 @@ bool p3ConnectMgr::isFriend(std::string id)
|
|||
return ret;
|
||||
}
|
||||
|
||||
bool p3ConnectMgr::isOnline(std::string id)
|
||||
bool p3ConnectMgr::isOnline(const std::string &id)
|
||||
{
|
||||
RsStackMutex stack(connMtx); /****** STACK LOCK MUTEX *******/
|
||||
|
||||
|
@ -1534,12 +1534,12 @@ bool p3ConnectMgr::isOnline(std::string id)
|
|||
return false;
|
||||
}
|
||||
|
||||
bool p3ConnectMgr::getFriendNetStatus(std::string id, peerConnectState &state)
|
||||
bool p3ConnectMgr::getFriendNetStatus(const std::string &id, peerConnectState &state)
|
||||
{
|
||||
RsStackMutex stack(connMtx); /****** STACK LOCK MUTEX *******/
|
||||
|
||||
/* check for existing */
|
||||
std::map<std::string, peerConnectState>::iterator it;
|
||||
std::map<std::string, peerConnectState>::iterator it;
|
||||
it = mFriendList.find(id);
|
||||
if (it == mFriendList.end())
|
||||
{
|
||||
|
@ -1551,12 +1551,12 @@ bool p3ConnectMgr::getFriendNetStatus(std::string id, peerConnectState &state)
|
|||
}
|
||||
|
||||
|
||||
bool p3ConnectMgr::getOthersNetStatus(std::string id, peerConnectState &state)
|
||||
bool p3ConnectMgr::getOthersNetStatus(const std::string &id, peerConnectState &state)
|
||||
{
|
||||
RsStackMutex stack(connMtx); /****** STACK LOCK MUTEX *******/
|
||||
|
||||
/* check for existing */
|
||||
std::map<std::string, peerConnectState>::iterator it;
|
||||
std::map<std::string, peerConnectState>::iterator it;
|
||||
it = mOthersList.find(id);
|
||||
if (it == mOthersList.end())
|
||||
{
|
||||
|
@ -1573,7 +1573,7 @@ void p3ConnectMgr::getOnlineList(std::list<std::string> &peers)
|
|||
RsStackMutex stack(connMtx); /****** STACK LOCK MUTEX *******/
|
||||
|
||||
/* check for existing */
|
||||
std::map<std::string, peerConnectState>::iterator it;
|
||||
std::map<std::string, peerConnectState>::iterator it;
|
||||
for(it = mFriendList.begin(); it != mFriendList.end(); it++)
|
||||
{
|
||||
if (it->second.state & RS_PEER_S_CONNECTED)
|
||||
|
@ -1681,14 +1681,14 @@ bool p3ConnectMgr::getPeerCount (unsigned int *pnFriendCount, unsigned int *pnOn
|
|||
}
|
||||
|
||||
|
||||
bool p3ConnectMgr::connectAttempt(std::string id, struct sockaddr_in &addr,
|
||||
bool p3ConnectMgr::connectAttempt(const std::string &id, struct sockaddr_in &addr,
|
||||
uint32_t &delay, uint32_t &period, uint32_t &type)
|
||||
|
||||
{
|
||||
RsStackMutex stack(connMtx); /****** STACK LOCK MUTEX *******/
|
||||
|
||||
/* check for existing */
|
||||
std::map<std::string, peerConnectState>::iterator it;
|
||||
std::map<std::string, peerConnectState>::iterator it;
|
||||
it = mFriendList.find(id);
|
||||
if (it == mFriendList.end())
|
||||
{
|
||||
|
@ -1751,7 +1751,7 @@ bool p3ConnectMgr::connectAttempt(std::string id, struct sockaddr_in &addr,
|
|||
*
|
||||
*/
|
||||
|
||||
bool p3ConnectMgr::connectResult(std::string id, bool success, uint32_t flags, struct sockaddr_in remote_peer_address)
|
||||
bool p3ConnectMgr::connectResult(const std::string &id, bool success, uint32_t flags, struct sockaddr_in remote_peer_address)
|
||||
{
|
||||
bool should_netAssistFriend_false = false ;
|
||||
bool should_netAssistFriend_true = false ;
|
||||
|
@ -2174,7 +2174,7 @@ void p3ConnectMgr::peerConnectRequest(std::string id, struct sockaddr_in radd
|
|||
/*******************************************************************/
|
||||
/*******************************************************************/
|
||||
|
||||
bool p3ConnectMgr::addFriend(std::string id, std::string gpg_id, uint32_t netMode, uint32_t visState, time_t lastContact)
|
||||
bool p3ConnectMgr::addFriend(const std::string &id, const std::string &gpg_id, uint32_t netMode, uint32_t visState, time_t lastContact)
|
||||
{
|
||||
bool should_netAssistFriend_true = false ;
|
||||
bool should_netAssistFriend_false = false ;
|
||||
|
@ -2300,7 +2300,7 @@ bool p3ConnectMgr::addFriend(std::string id, std::string gpg_id, uint32_t netMod
|
|||
}
|
||||
|
||||
|
||||
bool p3ConnectMgr::removeFriend(std::string id)
|
||||
bool p3ConnectMgr::removeFriend(const std::string &id)
|
||||
{
|
||||
|
||||
#ifdef CONN_DEBUG
|
||||
|
@ -2432,7 +2432,7 @@ bool p3ConnectMgr::addNeighbour(std::string id)
|
|||
/*******************************************************************/
|
||||
/*******************************************************************/
|
||||
/*************** External Control ****************/
|
||||
bool p3ConnectMgr::retryConnect(std::string id)
|
||||
bool p3ConnectMgr::retryConnect(const std::string &id)
|
||||
{
|
||||
/* push all available addresses onto the connect addr stack */
|
||||
#ifdef CONN_DEBUG
|
||||
|
@ -2450,7 +2450,7 @@ bool p3ConnectMgr::retryConnect(std::string id)
|
|||
|
||||
|
||||
|
||||
bool p3ConnectMgr::retryConnectUDP(std::string id, struct sockaddr_in &rUdpAddr)
|
||||
bool p3ConnectMgr::retryConnectUDP(const std::string &id, struct sockaddr_in &rUdpAddr)
|
||||
{
|
||||
RsStackMutex stack(connMtx); /****** STACK LOCK MUTEX *******/
|
||||
|
||||
|
@ -2521,7 +2521,7 @@ bool p3ConnectMgr::retryConnectUDP(std::string id, struct sockaddr_in &rUdpAdd
|
|||
|
||||
|
||||
|
||||
bool p3ConnectMgr::retryConnectTCP(std::string id)
|
||||
bool p3ConnectMgr::retryConnectTCP(const std::string &id)
|
||||
{
|
||||
RsStackMutex stack(connMtx); /****** STACK LOCK MUTEX *******/
|
||||
|
||||
|
@ -2918,7 +2918,7 @@ bool p3ConnectMgr::locked_ConnectAttempt_Complete(peerConnectState *peer)
|
|||
**********************************************************************/
|
||||
|
||||
|
||||
bool p3ConnectMgr::setLocalAddress(std::string id, struct sockaddr_in addr)
|
||||
bool p3ConnectMgr::setLocalAddress(const std::string &id, struct sockaddr_in addr)
|
||||
{
|
||||
if (id == AuthSSL::getAuthSSL()->OwnId())
|
||||
{
|
||||
|
@ -2975,7 +2975,7 @@ bool p3ConnectMgr::setLocalAddress(std::string id, struct sockaddr_in addr)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool p3ConnectMgr::setExtAddress(std::string id, struct sockaddr_in addr)
|
||||
bool p3ConnectMgr::setExtAddress(const std::string &id, struct sockaddr_in addr)
|
||||
{
|
||||
if (id == AuthSSL::getAuthSSL()->OwnId())
|
||||
{
|
||||
|
@ -3015,7 +3015,7 @@ bool p3ConnectMgr::setExtAddress(std::string id, struct sockaddr_in addr)
|
|||
}
|
||||
|
||||
|
||||
bool p3ConnectMgr::setDynDNS(std::string id, std::string dyndns)
|
||||
bool p3ConnectMgr::setDynDNS(const std::string &id, const std::string &dyndns)
|
||||
{
|
||||
if (id == AuthSSL::getAuthSSL()->OwnId())
|
||||
{
|
||||
|
@ -3088,7 +3088,7 @@ bool p3ConnectMgr::updateAddressList(const std::string& id, const pqiIpAddrSe
|
|||
return true;
|
||||
}
|
||||
|
||||
bool p3ConnectMgr::setNetworkMode(std::string id, uint32_t netMode)
|
||||
bool p3ConnectMgr::setNetworkMode(const std::string &id, uint32_t netMode)
|
||||
{
|
||||
if (id == AuthSSL::getAuthSSL()->OwnId())
|
||||
{
|
||||
|
@ -3129,7 +3129,7 @@ bool p3ConnectMgr::setNetworkMode(std::string id, uint32_t netMode)
|
|||
return false;
|
||||
}
|
||||
|
||||
bool p3ConnectMgr::setLocation(std::string id, std::string location)
|
||||
bool p3ConnectMgr::setLocation(const std::string &id, const std::string &location)
|
||||
{
|
||||
RsStackMutex stack(connMtx); /****** STACK LOCK MUTEX *******/
|
||||
|
||||
|
@ -3152,7 +3152,7 @@ bool p3ConnectMgr::setLocation(std::string id, std::string location)
|
|||
}
|
||||
}
|
||||
|
||||
bool p3ConnectMgr::setVisState(std::string id, uint32_t visState)
|
||||
bool p3ConnectMgr::setVisState(const std::string &id, uint32_t visState)
|
||||
{
|
||||
if (id == AuthSSL::getAuthSSL()->OwnId())
|
||||
{
|
||||
|
|
|
@ -229,7 +229,7 @@ bool checkNetAddress(); /* check our address is sensible */
|
|||
/*************** External Control ****************/
|
||||
bool shutdown(); /* blocking shutdown call */
|
||||
|
||||
bool retryConnect(std::string id);
|
||||
bool retryConnect(const std::string &id);
|
||||
|
||||
bool getUPnPState();
|
||||
bool getUPnPEnabled();
|
||||
|
@ -254,22 +254,22 @@ bool getExtFinderAddress(struct sockaddr_in &addr);
|
|||
void getNetStatus(pqiNetStatus &status);
|
||||
|
||||
void setOwnNetConfig(uint32_t netMode, uint32_t visState);
|
||||
bool setLocalAddress(std::string id, struct sockaddr_in addr);
|
||||
bool setExtAddress(std::string id, struct sockaddr_in addr);
|
||||
bool setDynDNS(std::string id, std::string dyndns);
|
||||
bool setLocalAddress(const std::string &id, struct sockaddr_in addr);
|
||||
bool setExtAddress(const std::string &id, struct sockaddr_in addr);
|
||||
bool setDynDNS(const std::string &id, const std::string &dyndns);
|
||||
bool updateAddressList(const std::string& id, const pqiIpAddrSet &addrs);
|
||||
|
||||
bool setNetworkMode(std::string id, uint32_t netMode);
|
||||
bool setVisState(std::string id, uint32_t visState);
|
||||
bool setNetworkMode(const std::string &id, uint32_t netMode);
|
||||
bool setVisState(const std::string &id, uint32_t visState);
|
||||
|
||||
bool setLocation(std::string pid, std::string location);//location is shown in the gui to differentiate ssl certs
|
||||
bool setLocation(const std::string &pid, const std::string &location);//location is shown in the gui to differentiate ssl certs
|
||||
|
||||
/* add/remove friends */
|
||||
bool addFriend(std::string ssl_id, std::string gpg_id, uint32_t netMode = RS_NET_MODE_UDP,
|
||||
bool addFriend(const std::string &ssl_id, const std::string &gpg_id, uint32_t netMode = RS_NET_MODE_UDP,
|
||||
uint32_t visState = RS_VIS_STATE_STD , time_t lastContact = 0);
|
||||
|
||||
bool removeFriend(std::string ssl_id);
|
||||
bool addNeighbour(std::string);
|
||||
bool removeFriend(const std::string &ssl_id);
|
||||
bool addNeighbour(const std::string&);
|
||||
|
||||
/*************** External Control ****************/
|
||||
|
||||
|
@ -277,10 +277,10 @@ bool addNeighbour(std::string);
|
|||
const std::string getOwnId();
|
||||
bool getOwnNetStatus(peerConnectState &state);
|
||||
|
||||
bool isFriend(std::string ssl_id);
|
||||
bool isOnline(std::string ssl_id);
|
||||
bool getFriendNetStatus(std::string id, peerConnectState &state);
|
||||
bool getOthersNetStatus(std::string id, peerConnectState &state);
|
||||
bool isFriend(const std::string &ssl_id);
|
||||
bool isOnline(const std::string &ssl_id);
|
||||
bool getFriendNetStatus(const std::string &id, peerConnectState &state);
|
||||
bool getOthersNetStatus(const std::string &id, peerConnectState &state);
|
||||
|
||||
void getOnlineList(std::list<std::string> &ssl_peers);
|
||||
void getFriendList(std::list<std::string> &ssl_peers);
|
||||
|
@ -300,9 +300,9 @@ virtual void peerConnectRequest(std::string id,
|
|||
//virtual void stunStatus(std::string id, struct sockaddr_in raddr, uint32_t type, uint32_t flags);
|
||||
|
||||
/****************** Connections *******************/
|
||||
bool connectAttempt(std::string id, struct sockaddr_in &addr,
|
||||
bool connectAttempt(const std::string &id, struct sockaddr_in &addr,
|
||||
uint32_t &delay, uint32_t &period, uint32_t &type);
|
||||
bool connectResult(std::string id, bool success, uint32_t flags, struct sockaddr_in remote_peer_address);
|
||||
bool connectResult(const std::string &id, bool success, uint32_t flags, struct sockaddr_in remote_peer_address);
|
||||
|
||||
/******************** Groups **********************/
|
||||
bool addGroup(RsGroupInfo &groupInfo);
|
||||
|
@ -368,10 +368,10 @@ void networkConsistencyCheck();
|
|||
void tickMonitors();
|
||||
|
||||
/* connect attempts UDP */
|
||||
bool retryConnectUDP(std::string id, struct sockaddr_in &rUdpAddr);
|
||||
bool retryConnectUDP(const std::string &id, struct sockaddr_in &rUdpAddr);
|
||||
|
||||
/* connect attempts TCP */
|
||||
bool retryConnectTCP(std::string id);
|
||||
bool retryConnectTCP(const std::string &id);
|
||||
|
||||
void locked_ConnectAttempt_CurrentAddresses(peerConnectState *peer);
|
||||
void locked_ConnectAttempt_HistoricalAddresses(peerConnectState *peer);
|
||||
|
|
|
@ -111,7 +111,7 @@ class NetInterface;
|
|||
class PQInterface: public RateInterface
|
||||
{
|
||||
public:
|
||||
PQInterface(std::string id) :peerId(id) { return; }
|
||||
PQInterface(const std::string &id) :peerId(id) { return; }
|
||||
virtual ~PQInterface() { return; }
|
||||
|
||||
/*!
|
||||
|
|
|
@ -50,7 +50,7 @@
|
|||
|
||||
const int pqistorezone = 9511;
|
||||
|
||||
pqistore::pqistore(RsSerialiser *rss, std::string srcId, BinInterface *bio_in, int bio_flags_in)
|
||||
pqistore::pqistore(RsSerialiser *rss, const std::string &srcId, BinInterface *bio_in, int bio_flags_in)
|
||||
:PQInterface(""), rsSerialiser(rss), bio(bio_in), bio_flags(bio_flags_in),
|
||||
nextPkt(NULL), mSrcId(srcId)
|
||||
{
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
class pqistore: public PQInterface
|
||||
{
|
||||
public:
|
||||
pqistore(RsSerialiser *rss, std::string srcId, BinInterface *bio_in, int bio_flagsin);
|
||||
pqistore(RsSerialiser *rss, const std::string &srcId, BinInterface *bio_in, int bio_flagsin);
|
||||
virtual ~pqistore();
|
||||
|
||||
// PQInterface
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue