Merge branch 'master' into logshutup1

This commit is contained in:
Pooh 2018-04-09 11:15:43 +03:00 committed by GitHub
commit 732e87a8bb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 36 additions and 40 deletions

View File

@ -2860,8 +2860,10 @@ void RsGenExchange::processRecvdMessages()
time_t now = time(NULL);
if(mMsgPendingValidate.empty())
return ;
#ifdef GEN_EXCH_DEBUG
if(!mMsgPendingValidate.empty())
else
std::cerr << "processing received messages" << std::endl;
#endif
// 1 - First, make sure items metadata is deserialised, clean old failed items, and collect the groups Ids we have to check
@ -2904,9 +2906,11 @@ void RsGenExchange::processRecvdMessages()
}
}
// 2 - Retrieve the metadata for the associated groups.
// 2 - Retrieve the metadata for the associated groups. The test is here to avoid the default behavior to
// retrieve all groups when the list is empty
mDataStore->retrieveGxsGrpMetaData(grpMetas);
if(!grpMetas.empty())
mDataStore->retrieveGxsGrpMetaData(grpMetas);
GxsMsgReq msgIds;
RsNxsMsgDataTemporaryList msgs_to_store;
@ -2934,7 +2938,7 @@ void RsGenExchange::processRecvdMessages()
// }
#ifdef GEN_EXCH_DEBUG
std::cerr << " deserialised info: grp id=" << meta->mGroupId << ", msg id=" << meta->mMsgId ;
std::cerr << " deserialised info: grp id=" << msg->grpId << ", msg id=" << msg->msgId ;
#endif
std::map<RsGxsGroupId, RsGxsGrpMetaData*>::iterator mit = grpMetas.find(msg->grpId);
@ -2977,8 +2981,8 @@ void RsGenExchange::processRecvdMessages()
msg->metaData->recvTS = time(NULL);
#ifdef GEN_EXCH_DEBUG
std::cerr << " new status flags: " << meta->mMsgStatus << std::endl;
std::cerr << " computed hash: " << meta->mHash << std::endl;
std::cerr << " new status flags: " << msg->metaData->mMsgStatus << std::endl;
std::cerr << " computed hash: " << msg->metaData->mHash << std::endl;
std::cerr << "Message received. Identity=" << msg->metaData->mAuthorId << ", from peer " << msg->PeerId() << std::endl;
#endif
@ -3062,9 +3066,6 @@ void RsGenExchange::processRecvdGroups()
GxsPendingItem<RsNxsGrp*, RsGxsGroupId>& gpsi = vit->second;
RsNxsGrp* grp = gpsi.mItem;
#ifdef GEN_EXCH_DEBUG
std::cerr << " processing validation for group " << meta->mGroupId << ", original attempt time: " << time(NULL) - gpsi.mFirstTryTS << " seconds ago" << std::endl;
#endif
if(grp->metaData == NULL)
{
RsGxsGrpMetaData* meta = new RsGxsGrpMetaData();
@ -3074,6 +3075,9 @@ void RsGenExchange::processRecvdGroups()
else
delete meta ;
}
#ifdef GEN_EXCH_DEBUG
std::cerr << " processing validation for group " << grp->metaData->mGroupId << ", original attempt time: " << time(NULL) - gpsi.mFirstTryTS << " seconds ago" << std::endl;
#endif
// early deletion of group from the pending list if it's malformed, not accepted, or has been tried unsuccessfully for too long
@ -3102,7 +3106,7 @@ void RsGenExchange::processRecvdGroups()
if(!grp->metaData->mAuthorId.isNull())
{
#ifdef GEN_EXCH_DEBUG
std::cerr << "Group routage info: Identity=" << meta->mAuthorId << " from " << grp->PeerId() << std::endl;
std::cerr << "Group routage info: Identity=" << grp->metaData->mAuthorId << " from " << grp->PeerId() << std::endl;
#endif
mRoutingClues[grp->metaData->mAuthorId].insert(grp->PeerId()) ;
}
@ -3349,7 +3353,7 @@ void RsGenExchange::removeDeleteExistingMessages( std::list<RsNxsMsg*>& msgs, Gx
const RsGxsMessageId::std_vector& msgIds = msgIdReq[(*cit2)->metaData->mGroupId];
#ifdef GEN_EXCH_DEBUG
std::cerr << " grpid=" << cit2->second->mGroupId << ", msgid=" << cit2->second->mMsgId ;
std::cerr << " grpid=" << (*cit2)->grpId << ", msgid=" << (*cit2)->msgId ;
#endif
// Avoid storing messages that are already in the database, as well as messages that are too old (or generally do not pass the database storage test)
@ -3369,7 +3373,7 @@ void RsGenExchange::removeDeleteExistingMessages( std::list<RsNxsMsg*>& msgs, Gx
}
}
#ifdef GEN_EXCH_DEBUG
std::cerr << " discarding " << cit2->second->mMsgId << std::endl;
std::cerr << " discarding " << (*cit2)->msgId << std::endl;
#endif
delete *cit2;

View File

@ -587,12 +587,12 @@ int pqissl::Delay_Connection()
int pqissl::Initiate_Connection()
{
#ifdef PQISSL_DEBUG
std::cout << __PRETTY_FUNCTION__ << std::endl;
std::cerr << __PRETTY_FUNCTION__ << " "
<< sockaddr_storage_tostring(remote_addr) << std::endl;
#endif
int err;
sockaddr_storage addr = remote_addr;
sockaddr_storage addr; sockaddr_storage_copy(remote_addr, addr);
if(waiting != WAITING_DELAY)
{
@ -640,15 +640,6 @@ int pqissl::Initiate_Connection()
return -1;
}
{
std::string out;
rs_sprintf(out, "pqissl::Initiate_Connection() Connecting To: %s via: ", PeerId().toStdString().c_str());
out += sockaddr_storage_tostring(addr);
#ifdef PQISSL_LOG_DEBUG2
rslog(RSL_WARNING, pqisslzone, out);
#endif
}
if (sockaddr_storage_isnull(addr))
{
rslog(RSL_WARNING, pqisslzone, "pqissl::Initiate_Connection() Invalid (0.0.0.0) Remote Address, Aborting Connect.");
@ -725,6 +716,11 @@ int pqissl::Initiate_Connection()
//std::cerr << "Setting Connect Timeout " << mConnectTimeout << " Seconds into Future " << std::endl;
sockaddr_storage_ipv4_to_ipv6(addr);
std::cerr << __PRETTY_FUNCTION__ << " Connecting To: "
<< PeerId().toStdString() <<" via: "
<< sockaddr_storage_tostring(addr) << std::endl;
if (0 != (err = unix_connect(osock, addr)))
{
switch (errno)

View File

@ -60,8 +60,10 @@ static struct RsLog::logInfo pqissllistenzoneInfo = {RsLog::Default, "p3peermgr"
pqissllistenbase::pqissllistenbase(const sockaddr_storage &addr, p3PeerMgr *pm)
: laddr(addr), mPeerMgr(pm), active(false)
: mPeerMgr(pm), active(false)
{
sockaddr_storage_copy(addr, laddr);
if (!(AuthSSL::getAuthSSL()-> active()))
{
pqioutput(PQL_ALERT, pqissllistenzone,
@ -208,26 +210,20 @@ int pqissllistenbase::setuplisten()
}
}
#ifdef OPEN_UNIVERSAL_PORT
struct sockaddr_storage tmpaddr = laddr;
if (!mPeerMgr->isHidden())
{
tmpaddr.ss_family = PF_INET6;
sockaddr_storage_zeroip(tmpaddr);
}
struct sockaddr_storage tmpaddr;
sockaddr_storage_copy(laddr, tmpaddr);
sockaddr_storage_ipv4_to_ipv6(tmpaddr);
if (!mPeerMgr->isHidden()) sockaddr_storage_zeroip(tmpaddr);
if (0 != (err = rs_bind(lsock, tmpaddr)))
#else
if (0 != (err = universal_bind(lsock, laddr)))
#endif
{
std::string out = "pqissllistenbase::setuplisten() Cannot Bind to Local Address!\n";
showSocketError(out);
pqioutput(PQL_ALERT, pqissllistenzone, out);
std::cerr << out << std::endl;
std::cerr << "laddr: " << sockaddr_storage_tostring(laddr) << std::endl;
#ifdef OPEN_UNIVERSAL_PORT
if (!mPeerMgr->isHidden()) std::cerr << "Zeroed tmpaddr: " << sockaddr_storage_tostring(tmpaddr) << std::endl;
#endif
std::cerr << out << std::endl
<< "tmpaddr: " << sockaddr_storage_tostring(tmpaddr)
<< std::endl;
print_stacktrace();
return -1;
}