mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-01-29 16:53:31 -05:00
More ipv6_to_ipv4 conversions
This commit is contained in:
parent
ac8b56951c
commit
f4a6090150
@ -331,7 +331,7 @@ const RsPeerId& p3PeerMgrIMPL::getOwnId()
|
|||||||
|
|
||||||
bool p3PeerMgrIMPL::getOwnNetStatus(peerState &state)
|
bool p3PeerMgrIMPL::getOwnNetStatus(peerState &state)
|
||||||
{
|
{
|
||||||
RsStackMutex stack(mPeerMtx); /****** STACK LOCK MUTEX *******/
|
RS_STACK_MUTEX(mPeerMtx);
|
||||||
state = mOwnState;
|
state = mOwnState;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -817,15 +817,12 @@ int p3PeerMgrIMPL::getFriendCount(bool ssl, bool online)
|
|||||||
|
|
||||||
bool p3PeerMgrIMPL::getFriendNetStatus(const RsPeerId &id, peerState &state)
|
bool p3PeerMgrIMPL::getFriendNetStatus(const RsPeerId &id, peerState &state)
|
||||||
{
|
{
|
||||||
RsStackMutex stack(mPeerMtx); /****** STACK LOCK MUTEX *******/
|
RS_STACK_MUTEX(mPeerMtx);
|
||||||
|
|
||||||
/* check for existing */
|
/* check for existing */
|
||||||
std::map<RsPeerId, peerState>::iterator it;
|
std::map<RsPeerId, peerState>::iterator it;
|
||||||
it = mFriendList.find(id);
|
it = mFriendList.find(id);
|
||||||
if (it == mFriendList.end())
|
if (it == mFriendList.end()) return false;
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
state = it->second;
|
state = it->second;
|
||||||
return true;
|
return true;
|
||||||
@ -834,26 +831,23 @@ bool p3PeerMgrIMPL::getFriendNetStatus(const RsPeerId &id, peerState &state)
|
|||||||
|
|
||||||
bool p3PeerMgrIMPL::getOthersNetStatus(const RsPeerId &id, peerState &state)
|
bool p3PeerMgrIMPL::getOthersNetStatus(const RsPeerId &id, peerState &state)
|
||||||
{
|
{
|
||||||
RsStackMutex stack(mPeerMtx); /****** STACK LOCK MUTEX *******/
|
RS_STACK_MUTEX(mPeerMtx);
|
||||||
|
|
||||||
/* check for existing */
|
/* check for existing */
|
||||||
std::map<RsPeerId, peerState>::iterator it;
|
std::map<RsPeerId, peerState>::iterator it;
|
||||||
it = mOthersList.find(id);
|
it = mOthersList.find(id);
|
||||||
if (it == mOthersList.end())
|
if (it == mOthersList.end()) return false;
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
state = it->second;
|
state = it->second;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
int p3PeerMgrIMPL::getConnectAddresses(const RsPeerId &id,
|
int p3PeerMgrIMPL::getConnectAddresses(
|
||||||
struct sockaddr_storage &lAddr, struct sockaddr_storage &eAddr,
|
const RsPeerId &id, sockaddr_storage &lAddr, sockaddr_storage &eAddr,
|
||||||
pqiIpAddrSet &histAddrs, std::string &dyndns)
|
pqiIpAddrSet &histAddrs, std::string &dyndns )
|
||||||
{
|
{
|
||||||
|
|
||||||
RsStackMutex stack(mPeerMtx); /****** STACK LOCK MUTEX *******/
|
RS_STACK_MUTEX(mPeerMtx);
|
||||||
|
|
||||||
/* check for existing */
|
/* check for existing */
|
||||||
std::map<RsPeerId, peerState>::iterator it;
|
std::map<RsPeerId, peerState>::iterator it;
|
||||||
|
@ -357,9 +357,9 @@ public:
|
|||||||
bool setOwnNetworkMode(uint32_t netMode);
|
bool setOwnNetworkMode(uint32_t netMode);
|
||||||
bool setOwnVisState(uint16_t vs_disc, uint16_t vs_dht);
|
bool setOwnVisState(uint16_t vs_disc, uint16_t vs_dht);
|
||||||
|
|
||||||
int getConnectAddresses(const RsPeerId &id,
|
int getConnectAddresses( const RsPeerId &id, sockaddr_storage &lAddr,
|
||||||
struct sockaddr_storage &lAddr, struct sockaddr_storage &eAddr,
|
sockaddr_storage &eAddr, pqiIpAddrSet &histAddrs,
|
||||||
pqiIpAddrSet &histAddrs, std::string &dyndns);
|
std::string &dyndns );
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -333,8 +333,9 @@ bool p3Peers::getPeerDetails(const RsPeerId& id, RsPeerDetails &d)
|
|||||||
d.hiddenNodePort = 0;
|
d.hiddenNodePort = 0;
|
||||||
d.hiddenType = RS_HIDDEN_TYPE_NONE;
|
d.hiddenType = RS_HIDDEN_TYPE_NONE;
|
||||||
|
|
||||||
if (sockaddr_storage_ipv6_to_ipv4(ps.localaddr))
|
if(!sockaddr_storage_isnull(ps.localaddr))
|
||||||
{
|
{
|
||||||
|
sockaddr_storage_ipv6_to_ipv4(ps.localaddr);
|
||||||
d.localAddr = sockaddr_storage_iptostring(ps.localaddr);
|
d.localAddr = sockaddr_storage_iptostring(ps.localaddr);
|
||||||
d.localPort = sockaddr_storage_port(ps.localaddr);
|
d.localPort = sockaddr_storage_port(ps.localaddr);
|
||||||
}
|
}
|
||||||
@ -344,8 +345,9 @@ bool p3Peers::getPeerDetails(const RsPeerId& id, RsPeerDetails &d)
|
|||||||
d.localPort = 0;
|
d.localPort = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sockaddr_storage_ipv6_to_ipv4(ps.serveraddr))
|
if(!sockaddr_storage_isnull(ps.serveraddr))
|
||||||
{
|
{
|
||||||
|
sockaddr_storage_ipv6_to_ipv4(ps.serveraddr);
|
||||||
d.extAddr = sockaddr_storage_iptostring(ps.serveraddr);
|
d.extAddr = sockaddr_storage_iptostring(ps.serveraddr);
|
||||||
d.extPort = sockaddr_storage_port(ps.serveraddr);
|
d.extPort = sockaddr_storage_port(ps.serveraddr);
|
||||||
}
|
}
|
||||||
@ -417,6 +419,7 @@ bool p3Peers::getPeerDetails(const RsPeerId& id, RsPeerDetails &d)
|
|||||||
|
|
||||||
if (pcs.state & RS_PEER_S_CONNECTED)
|
if (pcs.state & RS_PEER_S_CONNECTED)
|
||||||
{
|
{
|
||||||
|
sockaddr_storage_ipv6_to_ipv4(pcs.connectaddr);
|
||||||
d.connectAddr = sockaddr_storage_iptostring(pcs.connectaddr);
|
d.connectAddr = sockaddr_storage_iptostring(pcs.connectaddr);
|
||||||
d.connectPort = sockaddr_storage_port(pcs.connectaddr);
|
d.connectPort = sockaddr_storage_port(pcs.connectaddr);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user