mirror of
https://github.com/RetroShare/libretroshare.git
synced 2026-09-14 11:05:45 +05:00
added control over received peers from FS
This commit is contained in:
parent
21319c15c9
commit
a9ec9e3ef6
@ -227,3 +227,23 @@ std::map<RsPeerId,RsFriendServer::RsFsPeerInfo> FriendServerManager::getPeersInf
|
||||
return res;
|
||||
}
|
||||
|
||||
void FriendServerManager::allowPeer(const RsPeerId& pid)
|
||||
{
|
||||
auto fit = mAlreadyReceivedPeers.find(pid);
|
||||
|
||||
if(fit == mAlreadyReceivedPeers.end())
|
||||
{
|
||||
RsErr() << "FriendServerManager: unknown peer " << pid ;
|
||||
return;
|
||||
}
|
||||
RsPeerDetails det;
|
||||
uint32_t err_code;
|
||||
|
||||
if(!rsPeers->parseShortInvite(fit->second.first,det,err_code))
|
||||
{
|
||||
RsErr() << "Unexpected parsing error in short invite received by the friend server. Err_code=" << err_code ;
|
||||
return;
|
||||
}
|
||||
rsPeers->addSslOnlyFriend(det.id,det.gpg_id,det);
|
||||
}
|
||||
|
||||
|
||||
@ -24,7 +24,8 @@ public:
|
||||
|
||||
virtual std::map<RsPeerId,RsFsPeerInfo> getPeersInfo() override;
|
||||
virtual bool autoAddFriends() const override { return mAutoAddFriends; }
|
||||
virtual bool setAutoAddFriends(bool b) override { mAutoAddFriends = b; }
|
||||
virtual void setAutoAddFriends(bool b) override { mAutoAddFriends = b; }
|
||||
virtual void allowPeer(const RsPeerId& pid) override;
|
||||
protected:
|
||||
virtual void threadTick() override;
|
||||
|
||||
|
||||
@ -103,7 +103,7 @@ public:
|
||||
virtual void setFriendsToRequest(uint32_t) =0;
|
||||
|
||||
virtual bool autoAddFriends() const =0;
|
||||
virtual bool setAutoAddFriends(bool b) =0;
|
||||
virtual void setAutoAddFriends(bool b) =0;
|
||||
/*!
|
||||
* \brief setProfilePassphrase
|
||||
* Needs to be called as least once, and before the friend server is enabled, so as to be able to decrypt incoming information
|
||||
@ -116,6 +116,12 @@ public:
|
||||
virtual uint16_t friendsServerPort() =0;
|
||||
virtual std::string friendsServerAddress() =0;
|
||||
|
||||
/*!
|
||||
* \brief allowPeer
|
||||
* Allows the friend server to make the given peer as friend.
|
||||
*/
|
||||
virtual void allowPeer(const RsPeerId& pid) =0;
|
||||
|
||||
virtual std::map<RsPeerId,RsFsPeerInfo> getPeersInfo() =0 ;
|
||||
};
|
||||
|
||||
|
||||
@ -265,6 +265,8 @@ enum class RsConnectionEventCode: uint8_t
|
||||
PEER_DISCONNECTED = 0x02,
|
||||
PEER_TIME_SHIFT = 0x03, // mTimeShift = time shift in seconds
|
||||
PEER_REPORTS_WRONG_IP = 0x04, // mPeerLocator = address reported, mOwnLocator = own address
|
||||
PEER_ADDED = 0x05,
|
||||
PEER_REMOVED = 0x06,
|
||||
};
|
||||
|
||||
struct RsConnectionEvent : RsEvent
|
||||
|
||||
Loading…
Reference in New Issue
Block a user