mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-02 22:25:04 -04:00
added event handling when peer discovery is received
This commit is contained in:
parent
37dc37ce4a
commit
3f89a3300d
4 changed files with 38 additions and 12 deletions
|
@ -388,6 +388,15 @@ void p3discovery2::recvOwnContactInfo(const RsPeerId &fromId, const RsDiscContac
|
|||
if(!mPeerMgr->isHiddenNode(rsPeers->getOwnId()))
|
||||
updatePeerAddresses(item);
|
||||
|
||||
if(rsEvents)
|
||||
{
|
||||
auto ev = std::make_shared<RsGossipDiscoveryEvent>();
|
||||
ev->mGossipDiscoveryEventType = RsGossipDiscoveryEventType::FRIEND_PEER_INFO_RECEIVED;
|
||||
ev->mFromId = fromId;
|
||||
ev->mAboutId = item->sslId;
|
||||
rsEvents->postEvent(ev);
|
||||
}
|
||||
|
||||
// if the peer is not validated, we stop the exchange here
|
||||
|
||||
if(det.skip_pgp_signature_validation)
|
||||
|
@ -977,7 +986,18 @@ void p3discovery2::processContactInfo(const RsPeerId &fromId, const RsDiscContac
|
|||
RsServer::notify()->notifyListChange(NOTIFY_LIST_NEIGHBOURS, NOTIFY_TYPE_MOD);
|
||||
|
||||
if(should_notify_discovery)
|
||||
RsServer::notify()->notifyDiscInfoChanged();
|
||||
{
|
||||
RsServer::notify()->notifyDiscInfoChanged();
|
||||
|
||||
if(rsEvents)
|
||||
{
|
||||
auto ev = std::make_shared<RsGossipDiscoveryEvent>();
|
||||
ev->mGossipDiscoveryEventType = RsGossipDiscoveryEventType::FRIEND_PEER_INFO_RECEIVED;
|
||||
ev->mFromId = fromId;
|
||||
ev->mAboutId = item->sslId;
|
||||
rsEvents->postEvent(ev);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* we explictly request certificates, instead of getting them all the time
|
||||
|
|
|
@ -47,8 +47,8 @@ extern std::shared_ptr<RsGossipDiscovery> rsGossipDiscovery;
|
|||
*/
|
||||
|
||||
enum class RsGossipDiscoveryEventType: uint32_t {
|
||||
UNKNOWN = 0x00,
|
||||
PEER_INVITE_RECEIVED = 0x01
|
||||
UNKNOWN = 0x00,
|
||||
FRIEND_PEER_INFO_RECEIVED = 0x01,
|
||||
};
|
||||
|
||||
struct RsGossipDiscoveryEvent : RsEvent
|
||||
|
@ -57,7 +57,8 @@ struct RsGossipDiscoveryEvent : RsEvent
|
|||
virtual ~RsGossipDiscoveryEvent() override {}
|
||||
|
||||
RsGossipDiscoveryEventType mGossipDiscoveryEventType;
|
||||
std::string mInvite;
|
||||
RsPeerId mFromId;
|
||||
RsPeerId mAboutId;
|
||||
|
||||
/// @see RsSerializable
|
||||
virtual void serial_process( RsGenericSerializer::SerializeJob j,
|
||||
|
@ -65,8 +66,9 @@ struct RsGossipDiscoveryEvent : RsEvent
|
|||
{
|
||||
RsEvent::serial_process(j,ctx);
|
||||
RS_SERIAL_PROCESS(mGossipDiscoveryEventType);
|
||||
RS_SERIAL_PROCESS(mInvite);
|
||||
}
|
||||
RS_SERIAL_PROCESS(mFromId);
|
||||
RS_SERIAL_PROCESS(mAboutId);
|
||||
}
|
||||
};
|
||||
|
||||
class RsGossipDiscovery
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue