moved more peer connection notifications to rsEvents

This commit is contained in:
csoler 2019-12-07 21:43:28 +01:00
parent 9790b98605
commit f118b4656e
No known key found for this signature in database
GPG key ID: 7BCA522266C0804C
5 changed files with 57 additions and 35 deletions

View file

@ -367,12 +367,16 @@ int p3rtt::storePongResult(const RsPeerId& id, uint32_t counter, double recv_ts,
peerInfo->mCurrentMeanOffset = mean / peerInfo->mPongResults.size();
if(fabs(peerInfo->mCurrentMeanOffset) > 120)
{
p3Notify *notify = RsServer::notify();
if (notify)
{
//notify->AddPopupMessage(RS_POPUP_OFFSET, eerInfo->mId.toStdString(),"", "Time Offset: ");
notify->AddFeedItem(RS_FEED_ITEM_PEER_OFFSET, peerInfo->mId.toStdString());
}
if(rsEvents)
{
auto ev = std::make_shared<RsConnectionEvent>();
ev->mSslId = peerInfo->mId;
ev->mStrInfo1 = RsUtil::NumberToString(peerInfo->mCurrentMeanOffset,false);
ev->mConnectionInfoCode = RsConnectionEvent::PEER_TIME_SHIFT;
rsEvents->postEvent(ev);
}
std::cerr << "(WW) Peer:" << peerInfo->mId << " get time offset more than two minutes with you!!!" << std::endl;
}
}