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); time_t now = time(NULL);
if(mMsgPendingValidate.empty())
return ;
#ifdef GEN_EXCH_DEBUG #ifdef GEN_EXCH_DEBUG
if(!mMsgPendingValidate.empty()) else
std::cerr << "processing received messages" << std::endl; std::cerr << "processing received messages" << std::endl;
#endif #endif
// 1 - First, make sure items metadata is deserialised, clean old failed items, and collect the groups Ids we have to check // 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; GxsMsgReq msgIds;
RsNxsMsgDataTemporaryList msgs_to_store; RsNxsMsgDataTemporaryList msgs_to_store;
@ -2934,7 +2938,7 @@ void RsGenExchange::processRecvdMessages()
// } // }
#ifdef GEN_EXCH_DEBUG #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 #endif
std::map<RsGxsGroupId, RsGxsGrpMetaData*>::iterator mit = grpMetas.find(msg->grpId); std::map<RsGxsGroupId, RsGxsGrpMetaData*>::iterator mit = grpMetas.find(msg->grpId);
@ -2977,8 +2981,8 @@ void RsGenExchange::processRecvdMessages()
msg->metaData->recvTS = time(NULL); msg->metaData->recvTS = time(NULL);
#ifdef GEN_EXCH_DEBUG #ifdef GEN_EXCH_DEBUG
std::cerr << " new status flags: " << meta->mMsgStatus << std::endl; std::cerr << " new status flags: " << msg->metaData->mMsgStatus << std::endl;
std::cerr << " computed hash: " << meta->mHash << 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; std::cerr << "Message received. Identity=" << msg->metaData->mAuthorId << ", from peer " << msg->PeerId() << std::endl;
#endif #endif
@ -3062,9 +3066,6 @@ void RsGenExchange::processRecvdGroups()
GxsPendingItem<RsNxsGrp*, RsGxsGroupId>& gpsi = vit->second; GxsPendingItem<RsNxsGrp*, RsGxsGroupId>& gpsi = vit->second;
RsNxsGrp* grp = gpsi.mItem; 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) if(grp->metaData == NULL)
{ {
RsGxsGrpMetaData* meta = new RsGxsGrpMetaData(); RsGxsGrpMetaData* meta = new RsGxsGrpMetaData();
@ -3074,6 +3075,9 @@ void RsGenExchange::processRecvdGroups()
else else
delete meta ; 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 // 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()) if(!grp->metaData->mAuthorId.isNull())
{ {
#ifdef GEN_EXCH_DEBUG #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 #endif
mRoutingClues[grp->metaData->mAuthorId].insert(grp->PeerId()) ; 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]; const RsGxsMessageId::std_vector& msgIds = msgIdReq[(*cit2)->metaData->mGroupId];
#ifdef GEN_EXCH_DEBUG #ifdef GEN_EXCH_DEBUG
std::cerr << " grpid=" << cit2->second->mGroupId << ", msgid=" << cit2->second->mMsgId ; std::cerr << " grpid=" << (*cit2)->grpId << ", msgid=" << (*cit2)->msgId ;
#endif #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) // 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 #ifdef GEN_EXCH_DEBUG
std::cerr << " discarding " << cit2->second->mMsgId << std::endl; std::cerr << " discarding " << (*cit2)->msgId << std::endl;
#endif #endif
delete *cit2; delete *cit2;

View file

@ -587,12 +587,12 @@ int pqissl::Delay_Connection()
int pqissl::Initiate_Connection() int pqissl::Initiate_Connection()
{ {
#ifdef PQISSL_DEBUG #ifdef PQISSL_DEBUG
std::cout << __PRETTY_FUNCTION__ << std::endl; std::cerr << __PRETTY_FUNCTION__ << " "
<< sockaddr_storage_tostring(remote_addr) << std::endl;
#endif #endif
int err; int err;
sockaddr_storage addr = remote_addr; sockaddr_storage addr; sockaddr_storage_copy(remote_addr, addr);
if(waiting != WAITING_DELAY) if(waiting != WAITING_DELAY)
{ {
@ -640,15 +640,6 @@ int pqissl::Initiate_Connection()
return -1; 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)) if (sockaddr_storage_isnull(addr))
{ {
rslog(RSL_WARNING, pqisslzone, "pqissl::Initiate_Connection() Invalid (0.0.0.0) Remote Address, Aborting Connect."); 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; //std::cerr << "Setting Connect Timeout " << mConnectTimeout << " Seconds into Future " << std::endl;
sockaddr_storage_ipv4_to_ipv6(addr); 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))) if (0 != (err = unix_connect(osock, addr)))
{ {
switch (errno) switch (errno)

View file

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