mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-19 14:30:43 -04:00
added load/save of new thresholds in p3gxsreputation. Removed some unused variables
This commit is contained in:
parent
fb733916ef
commit
f3f0fcea05
3 changed files with 26 additions and 44 deletions
|
@ -65,13 +65,8 @@ public:
|
||||||
|
|
||||||
// parameters
|
// parameters
|
||||||
|
|
||||||
// virtual void setNodeAutoBanThreshold(uint32_t n) =0;
|
|
||||||
// virtual uint32_t nodeAutoBanThreshold() =0;
|
|
||||||
|
|
||||||
virtual void setNodeAutoPositiveOpinionForContacts(bool b) =0;
|
virtual void setNodeAutoPositiveOpinionForContacts(bool b) =0;
|
||||||
virtual bool nodeAutoPositiveOpinionForContacts() =0;
|
virtual bool nodeAutoPositiveOpinionForContacts() =0;
|
||||||
virtual float nodeAutoBanIdentitiesLimit() =0;
|
|
||||||
virtual void setNodeAutoBanIdentitiesLimit(float f) =0;
|
|
||||||
|
|
||||||
virtual uint32_t thresholdForRemotelyNegativeReputation()=0;
|
virtual uint32_t thresholdForRemotelyNegativeReputation()=0;
|
||||||
virtual uint32_t thresholdForRemotelyPositiveReputation()=0;
|
virtual uint32_t thresholdForRemotelyPositiveReputation()=0;
|
||||||
|
|
|
@ -261,27 +261,6 @@ bool p3GxsReputation::nodeAutoPositiveOpinionForContacts()
|
||||||
RsStackMutex stack(mReputationMtx); /****** LOCKED MUTEX *******/
|
RsStackMutex stack(mReputationMtx); /****** LOCKED MUTEX *******/
|
||||||
return mAutoSetPositiveOptionToContacts ;
|
return mAutoSetPositiveOptionToContacts ;
|
||||||
}
|
}
|
||||||
float p3GxsReputation::nodeAutoBanIdentitiesLimit()
|
|
||||||
{
|
|
||||||
RsStackMutex stack(mReputationMtx); /****** LOCKED MUTEX *******/
|
|
||||||
return mAutoBanIdentitiesLimit - 1.0f;
|
|
||||||
}
|
|
||||||
void p3GxsReputation::setNodeAutoBanIdentitiesLimit(float f)
|
|
||||||
{
|
|
||||||
RsStackMutex stack(mReputationMtx); /****** LOCKED MUTEX *******/
|
|
||||||
|
|
||||||
if(f < -1.0 || f >= 0.0)
|
|
||||||
{
|
|
||||||
std::cerr << "(EE) Unexpected value for auto ban identities limit: " << f << std::endl;
|
|
||||||
return ;
|
|
||||||
}
|
|
||||||
if(f != mAutoBanIdentitiesLimit)
|
|
||||||
{
|
|
||||||
mLastBannedNodesUpdate = 0 ;
|
|
||||||
mAutoBanIdentitiesLimit = f+1.0 ;
|
|
||||||
IndicateConfigChanged() ;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int p3GxsReputation::status()
|
int p3GxsReputation::status()
|
||||||
{
|
{
|
||||||
|
@ -1097,9 +1076,14 @@ bool p3GxsReputation::saveList(bool& cleanup, std::list<RsItem*> &savelist)
|
||||||
|
|
||||||
RsConfigKeyValueSet *vitem = new RsConfigKeyValueSet ;
|
RsConfigKeyValueSet *vitem = new RsConfigKeyValueSet ;
|
||||||
RsTlvKeyValue kv;
|
RsTlvKeyValue kv;
|
||||||
// kv.key = "AUTO_BAN_NODES_THRESHOLD" ;
|
|
||||||
// rs_sprintf(kv.value, "%d", mPgpAutoBanThreshold);
|
kv.key = "AUTO_REMOTELY_POSITIVE_THRESHOLD" ;
|
||||||
// vitem->tlvkvs.pairs.push_back(kv) ;
|
rs_sprintf(kv.value, "%d", mMinVotesForRemotelyPositive);
|
||||||
|
vitem->tlvkvs.pairs.push_back(kv) ;
|
||||||
|
|
||||||
|
kv.key = "AUTO_REMOTELY_NEGATIVE_THRESHOLD" ;
|
||||||
|
rs_sprintf(kv.value, "%d", mMinVotesForRemotelyNegative);
|
||||||
|
vitem->tlvkvs.pairs.push_back(kv) ;
|
||||||
|
|
||||||
kv.key = "AUTO_BAN_IDENTITIES_THRESHOLD" ;
|
kv.key = "AUTO_BAN_IDENTITIES_THRESHOLD" ;
|
||||||
rs_sprintf(kv.value, "%f", mAutoBanIdentitiesLimit);
|
rs_sprintf(kv.value, "%f", mAutoBanIdentitiesLimit);
|
||||||
|
@ -1164,16 +1148,24 @@ bool p3GxsReputation::loadList(std::list<RsItem *>& loadList)
|
||||||
if(vitem)
|
if(vitem)
|
||||||
for(std::list<RsTlvKeyValue>::const_iterator kit = vitem->tlvkvs.pairs.begin(); kit != vitem->tlvkvs.pairs.end(); ++kit)
|
for(std::list<RsTlvKeyValue>::const_iterator kit = vitem->tlvkvs.pairs.begin(); kit != vitem->tlvkvs.pairs.end(); ++kit)
|
||||||
{
|
{
|
||||||
// if(kit->key == "AUTO_BAN_NODES_THRESHOLD")
|
if(kit->key == "AUTO_REMOTELY_POSITIVE_THRESHOLD")
|
||||||
// {
|
{
|
||||||
// int val ;
|
int val ;
|
||||||
// if (sscanf(kit->value.c_str(), "%d", &val) == 1)
|
if (sscanf(kit->value.c_str(), "%d", &val) == 1)
|
||||||
// {
|
{
|
||||||
// mPgpAutoBanThreshold = val ;
|
mMinVotesForRemotelyPositive = val ;
|
||||||
// std::cerr << "Setting AutoBanNode threshold to " << val << std::endl ;
|
std::cerr << "Setting mMinVotesForRemotelyPositive threshold to " << val << std::endl ;
|
||||||
// mLastBannedNodesUpdate = 0 ; // force update
|
}
|
||||||
// }
|
};
|
||||||
// };
|
if(kit->key == "AUTO_REMOTELY_NEGATIVE_THRESHOLD")
|
||||||
|
{
|
||||||
|
int val ;
|
||||||
|
if (sscanf(kit->value.c_str(), "%d", &val) == 1)
|
||||||
|
{
|
||||||
|
mMinVotesForRemotelyNegative = val ;
|
||||||
|
std::cerr << "Setting mMinVotesForRemotelyNegative threshold to " << val << std::endl ;
|
||||||
|
}
|
||||||
|
};
|
||||||
if(kit->key == "AUTO_BAN_IDENTITIES_THRESHOLD")
|
if(kit->key == "AUTO_BAN_IDENTITIES_THRESHOLD")
|
||||||
{
|
{
|
||||||
float val ;
|
float val ;
|
||||||
|
|
|
@ -112,13 +112,8 @@ public:
|
||||||
virtual bool isNodeBanned(const RsPgpId& id);
|
virtual bool isNodeBanned(const RsPgpId& id);
|
||||||
virtual void banNode(const RsPgpId& id,bool b) ;
|
virtual void banNode(const RsPgpId& id,bool b) ;
|
||||||
|
|
||||||
//virtual void setNodeAutoBanThreshold(uint32_t n) ;
|
|
||||||
//virtual uint32_t nodeAutoBanThreshold() ;
|
|
||||||
|
|
||||||
virtual void setNodeAutoPositiveOpinionForContacts(bool b) ;
|
virtual void setNodeAutoPositiveOpinionForContacts(bool b) ;
|
||||||
virtual bool nodeAutoPositiveOpinionForContacts() ;
|
virtual bool nodeAutoPositiveOpinionForContacts() ;
|
||||||
virtual float nodeAutoBanIdentitiesLimit() ;
|
|
||||||
virtual void setNodeAutoBanIdentitiesLimit(float f) ;
|
|
||||||
|
|
||||||
uint32_t thresholdForRemotelyNegativeReputation();
|
uint32_t thresholdForRemotelyNegativeReputation();
|
||||||
uint32_t thresholdForRemotelyPositiveReputation();
|
uint32_t thresholdForRemotelyPositiveReputation();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue