mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-04-01 19:45:52 -04:00
added load/save of new thresholds in p3gxsreputation. Removed some unused variables
This commit is contained in:
parent
fb733916ef
commit
f3f0fcea05
@ -65,13 +65,8 @@ public:
|
||||
|
||||
// parameters
|
||||
|
||||
// virtual void setNodeAutoBanThreshold(uint32_t n) =0;
|
||||
// virtual uint32_t nodeAutoBanThreshold() =0;
|
||||
|
||||
virtual void setNodeAutoPositiveOpinionForContacts(bool b) =0;
|
||||
virtual bool nodeAutoPositiveOpinionForContacts() =0;
|
||||
virtual float nodeAutoBanIdentitiesLimit() =0;
|
||||
virtual void setNodeAutoBanIdentitiesLimit(float f) =0;
|
||||
|
||||
virtual uint32_t thresholdForRemotelyNegativeReputation()=0;
|
||||
virtual uint32_t thresholdForRemotelyPositiveReputation()=0;
|
||||
|
@ -261,27 +261,6 @@ bool p3GxsReputation::nodeAutoPositiveOpinionForContacts()
|
||||
RsStackMutex stack(mReputationMtx); /****** LOCKED MUTEX *******/
|
||||
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()
|
||||
{
|
||||
@ -1097,9 +1076,14 @@ bool p3GxsReputation::saveList(bool& cleanup, std::list<RsItem*> &savelist)
|
||||
|
||||
RsConfigKeyValueSet *vitem = new RsConfigKeyValueSet ;
|
||||
RsTlvKeyValue kv;
|
||||
// kv.key = "AUTO_BAN_NODES_THRESHOLD" ;
|
||||
// rs_sprintf(kv.value, "%d", mPgpAutoBanThreshold);
|
||||
// vitem->tlvkvs.pairs.push_back(kv) ;
|
||||
|
||||
kv.key = "AUTO_REMOTELY_POSITIVE_THRESHOLD" ;
|
||||
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" ;
|
||||
rs_sprintf(kv.value, "%f", mAutoBanIdentitiesLimit);
|
||||
@ -1164,16 +1148,24 @@ bool p3GxsReputation::loadList(std::list<RsItem *>& loadList)
|
||||
if(vitem)
|
||||
for(std::list<RsTlvKeyValue>::const_iterator kit = vitem->tlvkvs.pairs.begin(); kit != vitem->tlvkvs.pairs.end(); ++kit)
|
||||
{
|
||||
// if(kit->key == "AUTO_BAN_NODES_THRESHOLD")
|
||||
// {
|
||||
// int val ;
|
||||
// if (sscanf(kit->value.c_str(), "%d", &val) == 1)
|
||||
// {
|
||||
// mPgpAutoBanThreshold = val ;
|
||||
// std::cerr << "Setting AutoBanNode threshold to " << val << std::endl ;
|
||||
// mLastBannedNodesUpdate = 0 ; // force update
|
||||
// }
|
||||
// };
|
||||
if(kit->key == "AUTO_REMOTELY_POSITIVE_THRESHOLD")
|
||||
{
|
||||
int val ;
|
||||
if (sscanf(kit->value.c_str(), "%d", &val) == 1)
|
||||
{
|
||||
mMinVotesForRemotelyPositive = val ;
|
||||
std::cerr << "Setting mMinVotesForRemotelyPositive threshold to " << val << std::endl ;
|
||||
}
|
||||
};
|
||||
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")
|
||||
{
|
||||
float val ;
|
||||
|
@ -112,13 +112,8 @@ public:
|
||||
virtual bool isNodeBanned(const RsPgpId& id);
|
||||
virtual void banNode(const RsPgpId& id,bool b) ;
|
||||
|
||||
//virtual void setNodeAutoBanThreshold(uint32_t n) ;
|
||||
//virtual uint32_t nodeAutoBanThreshold() ;
|
||||
|
||||
virtual void setNodeAutoPositiveOpinionForContacts(bool b) ;
|
||||
virtual bool nodeAutoPositiveOpinionForContacts() ;
|
||||
virtual float nodeAutoBanIdentitiesLimit() ;
|
||||
virtual void setNodeAutoBanIdentitiesLimit(float f) ;
|
||||
|
||||
uint32_t thresholdForRemotelyNegativeReputation();
|
||||
uint32_t thresholdForRemotelyPositiveReputation();
|
||||
|
Loading…
x
Reference in New Issue
Block a user