* silly ( A || B) bug... B isn't called if A is true. Stopped addition of Entries in p3BanList

* Only include External Addresses in the Peer Ban scheme (done in LinkMgr and p3BanList)
 * Disabled p3Dsdv before it is too widely used.



git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5-dhtmods@4704 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
drbob 2011-12-01 17:21:52 +00:00
parent ed18152596
commit 92c53ff0d2
3 changed files with 24 additions and 5 deletions

View file

@ -103,7 +103,8 @@ bool p3BanList::processIncoming()
break;
case RS_PKT_SUBTYPE_BANLIST_ITEM:
{
updated = (updated || recvBanItem((RsBanListItem *) item));
// Order is important!.
updated = (recvBanItem((RsBanListItem *) item) || updated);
}
break;
}
@ -136,8 +137,9 @@ bool p3BanList::recvBanItem(RsBanListItem *item)
std::list<RsTlvBanListEntry>::const_iterator it;
for(it = item->peerList.entries.begin(); it != item->peerList.entries.end(); it++)
{
updated = (updated || addBanEntry(item->PeerId(),
it->addr, it->level, it->reason, it->age));
// Order is important!.
updated = (addBanEntry(item->PeerId(), it->addr, it->level,
it->reason, it->age) || updated);
}
return updated;
}
@ -173,6 +175,17 @@ bool p3BanList::addBanEntry(const std::string &peerId, const struct sockaddr_in
std::cerr << std::endl;
#endif
/* Only Accept it - if external address */
if (!isExternalNet(&(addr.sin_addr)))
{
#ifdef DEBUG_BANLIST
std::cerr << "p3BanList::addBanEntry() Ignoring Non External Addr: " << rs_inet_ntoa(addr.sin_addr);
std::cerr << std::endl;
#endif
return false;
}
std::map<std::string, BanList>::iterator it;
it = mBanSources.find(peerId);
if (it == mBanSources.end())