merged upstream/master

This commit is contained in:
csoler 2019-09-08 20:35:23 +02:00
commit 6419b03a2a
No known key found for this signature in database
GPG key ID: 7BCA522266C0804C
131 changed files with 6081 additions and 1473 deletions

View file

@ -100,8 +100,9 @@ void DiscPgpInfo::mergeFriendList(const std::set<PGPID> &friends)
p3discovery2::p3discovery2(
p3PeerMgr* peerMgr, p3LinkMgr* linkMgr, p3NetMgr* netMgr,
p3ServiceControl* sc, RsGixs* gixs ) :
p3Service(), mRsEventsHandle(0), mPeerMgr(peerMgr), mLinkMgr(linkMgr), mNetMgr(netMgr),
mServiceCtrl(sc), mGixs(gixs), mDiscMtx("p3discovery2"), mLastPgpUpdate(0)
p3Service(), mRsEventsHandle(0), mPeerMgr(peerMgr), mLinkMgr(linkMgr),
mNetMgr(netMgr), mServiceCtrl(sc), mGixs(gixs), mDiscMtx("p3discovery2"),
mLastPgpUpdate(0)
{
Dbg3() << __PRETTY_FUNCTION__ << std::endl;
@ -111,9 +112,12 @@ p3discovery2::p3discovery2(
// Add self into PGP FriendList.
mFriendList[AuthGPG::getAuthGPG()->getGPGOwnId()] = DiscPgpInfo();
rsEvents->registerEventsHandler(
[this](const RsEvent& event){ rsEventsHandler(event); },
mRsEventsHandle );
if(rsEvents)
rsEvents->registerEventsHandler(
[this](std::shared_ptr<const RsEvent> event)
{
rsEventsHandler(*event);
}, mRsEventsHandle ); // mRsEventsHandle is zeroed in initializer list
}
@ -1240,12 +1244,9 @@ void p3discovery2::recvInvite(
std::unique_ptr<RsGossipDiscoveryInviteItem> inviteItem )
{
typedef RsGossipDiscoveryFriendInviteReceivedEvent Evt_t;
// Ensure rsEvents is not deleted while we use it
std::shared_ptr<RsEvents> lockedRsEvents = rsEvents;
if(lockedRsEvents)
lockedRsEvents->postEvent(
std::unique_ptr<Evt_t>(new Evt_t(inviteItem->mInvite)) );
if(rsEvents)
rsEvents->postEvent(
std::shared_ptr<Evt_t>(new Evt_t(inviteItem->mInvite)) );
}
void p3discovery2::rsEventsHandler(const RsEvent& event)