mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-05 07:35:12 -04:00
Changes to libretroshare to get it to compile (still missing fns - so won't link yet!)
git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5-netupgrade@4419 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
6eb27c9a1a
commit
bbd11e69c1
17 changed files with 924 additions and 4726 deletions
|
@ -134,13 +134,6 @@ p3LinkMgr::p3LinkMgr(p3PeerMgr *peerMgr, p3NetMgr *netMgr)
|
|||
|
||||
{
|
||||
RsStackMutex stack(mLinkMtx); /****** STACK LOCK MUTEX *******/
|
||||
|
||||
/* setup basics of own state */
|
||||
mOwnState.id = AuthSSL::getAuthSSL()->OwnId();
|
||||
mOwnState.name = AuthGPG::getAuthGPG()->getGPGOwnName();
|
||||
|
||||
// user decided.
|
||||
//mOwnState.netMode |= RS_NET_MODE_TRY_UPNP;
|
||||
|
||||
mAllowTunnelConnection = false;
|
||||
mDNSResolver = new DNSResolver();
|
||||
|
@ -236,9 +229,43 @@ int p3LinkMgr::getOnlineCount()
|
|||
}
|
||||
|
||||
|
||||
void p3LinkMgr::setFriendVisibility(const std::string &id, bool isVisible)
|
||||
{
|
||||
/* set visibility */
|
||||
{
|
||||
RsStackMutex stack(mLinkMtx); /****** STACK LOCK MUTEX *******/
|
||||
|
||||
int count = 0;
|
||||
|
||||
std::map<std::string, peerConnectState>::iterator it;
|
||||
it = mFriendList.find(id);
|
||||
if (it == mFriendList.end())
|
||||
{
|
||||
/* */
|
||||
std::cerr << "p3LinkMgr::setFriendVisibility() ERROR peer unknown: " << id;
|
||||
std::cerr << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
if (it->second.dhtVisible == isVisible)
|
||||
{
|
||||
/* no change in state */
|
||||
return;
|
||||
}
|
||||
|
||||
it->second.dhtVisible = isVisible;
|
||||
|
||||
if (it->second.state & RS_PEER_S_CONNECTED)
|
||||
{
|
||||
/* dont worry about it */
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* switch the NetAssistOn/Off */
|
||||
mNetMgr->netAssistFriend(id, isVisible);
|
||||
}
|
||||
|
||||
|
||||
void p3LinkMgr::tick()
|
||||
{
|
||||
|
@ -1176,7 +1203,7 @@ bool p3LinkMgr::retryConnectTCP(const std::string &id)
|
|||
pqiIpAddrSet histAddrs;
|
||||
std::string dyndns;
|
||||
|
||||
if (mPeerMgr->setConnectAddresses(id, lAddr, eAddr, histAddrs, dyndns))
|
||||
if (mPeerMgr->getConnectAddresses(id, lAddr, eAddr, histAddrs, dyndns))
|
||||
{
|
||||
RsStackMutex stack(mLinkMtx); /****** STACK LOCK MUTEX *******/
|
||||
|
||||
|
@ -1539,4 +1566,57 @@ bool p3LinkMgr::locked_ConnectAttempt_Complete(peerConnectState *peer)
|
|||
}
|
||||
|
||||
|
||||
/***********************************************************************************************************
|
||||
************************************* Handling of Friends *************************************************
|
||||
***********************************************************************************************************/
|
||||
|
||||
int p3LinkMgr::addFriend(const std::string &id, bool isVisible)
|
||||
{
|
||||
{
|
||||
RsStackMutex stack(mLinkMtx); /****** STACK LOCK MUTEX *******/
|
||||
|
||||
std::map<std::string, peerConnectState>::iterator it;
|
||||
it = mFriendList.find(id);
|
||||
|
||||
if (it != mFriendList.end())
|
||||
{
|
||||
std::cerr << "p3LinkMgr::addFriend() ERROR, friend already exists : " << id;
|
||||
std::cerr << std::endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
peerConnectState pcs;
|
||||
pcs.dhtVisible = isVisible;
|
||||
|
||||
mFriendList[id] = pcs;
|
||||
}
|
||||
|
||||
mNetMgr->netAssistFriend(id, isVisible);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
int p3LinkMgr::removeFriend(const std::string &id)
|
||||
{
|
||||
RsStackMutex stack(mLinkMtx); /****** STACK LOCK MUTEX *******/
|
||||
|
||||
std::map<std::string, peerConnectState>::iterator it;
|
||||
it = mFriendList.find(id);
|
||||
|
||||
if (it == mFriendList.end())
|
||||
{
|
||||
std::cerr << "p3LinkMgr::removeFriend() ERROR, friend not there : " << id;
|
||||
std::cerr << std::endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
mFriendList.erase(it);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue