mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-07-21 13:49:04 -04:00
various small fixes in reputation/identity cleaning
This commit is contained in:
parent
bd7f6aca99
commit
70a92a1c32
3 changed files with 34 additions and 13 deletions
|
@ -166,6 +166,7 @@ p3GxsReputation::p3GxsReputation(p3LinkMgr *lm)
|
||||||
|
|
||||||
mLastReputationConfigSaved = 0;
|
mLastReputationConfigSaved = 0;
|
||||||
mChanged = false ;
|
mChanged = false ;
|
||||||
|
mMaxPreventReloadBannedIds = BANNED_NODES_INACTIVITY_KEEP_DEFAULT;
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::string GXS_REPUTATION_APP_NAME = "gxsreputation";
|
const std::string GXS_REPUTATION_APP_NAME = "gxsreputation";
|
||||||
|
@ -261,9 +262,9 @@ void p3GxsReputation::setRememberDeletedNodesThreshold(uint32_t days)
|
||||||
{
|
{
|
||||||
RsStackMutex stack(mReputationMtx); /****** LOCKED MUTEX *******/
|
RsStackMutex stack(mReputationMtx); /****** LOCKED MUTEX *******/
|
||||||
|
|
||||||
if(mMaxPreventReloadBannedIds != days/86400)
|
if(mMaxPreventReloadBannedIds != days*86400)
|
||||||
{
|
{
|
||||||
mMaxPreventReloadBannedIds = days/86400 ;
|
mMaxPreventReloadBannedIds = days*86400 ;
|
||||||
IndicateConfigChanged();
|
IndicateConfigChanged();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -384,6 +385,14 @@ void p3GxsReputation::cleanup()
|
||||||
{
|
{
|
||||||
bool should_delete = false ;
|
bool should_delete = false ;
|
||||||
|
|
||||||
|
if(it->second.mOwnOpinion == RsReputations::OPINION_NEGATIVE && mMaxPreventReloadBannedIds != 0 && it->second.mOwnOpinionTs + mMaxPreventReloadBannedIds < now)
|
||||||
|
{
|
||||||
|
#ifdef DEBUG_REPUTATION
|
||||||
|
std::cerr << " ID " << it->first << ": own is negative for more than " << mMaxPreventReloadBannedIds/86400 << " days. Reseting it!" << std::endl;
|
||||||
|
#endif
|
||||||
|
mChanged = true ;
|
||||||
|
}
|
||||||
|
|
||||||
// Delete slots with basically no information
|
// Delete slots with basically no information
|
||||||
|
|
||||||
if(it->second.mOpinions.empty() && it->second.mOwnOpinion == RsReputations::OPINION_NEUTRAL && (it->second.mOwnerNode.isNull()))
|
if(it->second.mOpinions.empty() && it->second.mOwnOpinion == RsReputations::OPINION_NEUTRAL && (it->second.mOwnerNode.isNull()))
|
||||||
|
|
|
@ -421,11 +421,17 @@ public:
|
||||||
|
|
||||||
time_t last_usage_ts = no_ts?0:(it->second.TS);
|
time_t last_usage_ts = no_ts?0:(it->second.TS);
|
||||||
time_t max_keep_time ;
|
time_t max_keep_time ;
|
||||||
|
bool should_check = true ;
|
||||||
|
|
||||||
if(no_ts)
|
if(no_ts)
|
||||||
max_keep_time = 0 ;
|
max_keep_time = 0 ;
|
||||||
else if(is_id_banned)
|
else if(is_id_banned)
|
||||||
|
{
|
||||||
|
if(mMaxKeepKeysBanned == 0)
|
||||||
|
should_check = false ;
|
||||||
|
else
|
||||||
max_keep_time = mMaxKeepKeysBanned ;
|
max_keep_time = mMaxKeepKeysBanned ;
|
||||||
|
}
|
||||||
else if(is_known_id)
|
else if(is_known_id)
|
||||||
max_keep_time = MAX_KEEP_KEYS_SIGNED_KNOWN ;
|
max_keep_time = MAX_KEEP_KEYS_SIGNED_KNOWN ;
|
||||||
else if(is_signed_id)
|
else if(is_signed_id)
|
||||||
|
@ -435,7 +441,7 @@ public:
|
||||||
|
|
||||||
std::cerr << ". Max keep = " << max_keep_time/86400 << " days. Unused for " << (now - last_usage_ts + 86399)/86400 << " days " ;
|
std::cerr << ". Max keep = " << max_keep_time/86400 << " days. Unused for " << (now - last_usage_ts + 86399)/86400 << " days " ;
|
||||||
|
|
||||||
if(now > last_usage_ts + max_keep_time)
|
if(should_check && now > last_usage_ts + max_keep_time)
|
||||||
{
|
{
|
||||||
std::cerr << " => delete " << std::endl;
|
std::cerr << " => delete " << std::endl;
|
||||||
ids_to_delete.push_back(gxs_id) ;
|
ids_to_delete.push_back(gxs_id) ;
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
<item>
|
<item>
|
||||||
<widget class="QGroupBox" name="generalGroupBox">
|
<widget class="QGroupBox" name="generalGroupBox">
|
||||||
<property name="title">
|
<property name="title">
|
||||||
<string>Identities handling</string>
|
<string>Reputation</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
<item>
|
<item>
|
||||||
|
@ -41,7 +41,7 @@
|
||||||
<string>Difference in votes to make friends globally negative:</string>
|
<string>Difference in votes to make friends globally negative:</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="alignment">
|
<property name="alignment">
|
||||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
@ -80,7 +80,7 @@
|
||||||
<string>Difference in votes to make friends globally positive:</string>
|
<string>Difference in votes to make friends globally positive:</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="alignment">
|
<property name="alignment">
|
||||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
@ -90,10 +90,10 @@
|
||||||
<enum>Qt::RightToLeft</enum>
|
<enum>Qt::RightToLeft</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Delete banned identities after:</string>
|
<string>Delete banned identities after (0 means indefinitely):</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="alignment">
|
<property name="alignment">
|
||||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
@ -103,15 +103,18 @@
|
||||||
<enum>Qt::RightToLeft</enum>
|
<enum>Qt::RightToLeft</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Prevent re-loading previously banned identities for:</string>
|
<string>Reset reputation of banned identities after (0 means never):</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="alignment">
|
<property name="alignment">
|
||||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="2">
|
<item row="2" column="2">
|
||||||
<widget class="QSpinBox" name="deleteBannedIdentitiesAfter_SB">
|
<widget class="QSpinBox" name="deleteBannedIdentitiesAfter_SB">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string><html><head/><body><p>Banned identities are not stamped and therefore lose activity. They get deleted automatically after a finit period of time.</p></body></html></string>
|
||||||
|
</property>
|
||||||
<property name="suffix">
|
<property name="suffix">
|
||||||
<string> days</string>
|
<string> days</string>
|
||||||
</property>
|
</property>
|
||||||
|
@ -125,6 +128,9 @@
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="2">
|
<item row="3" column="2">
|
||||||
<widget class="QSpinBox" name="preventReloadingBannedIdentitiesFor_SB">
|
<widget class="QSpinBox" name="preventReloadingBannedIdentitiesFor_SB">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string><html><head/><body><p>In order to prevent deleted banned IDs to come back because they are used in e.g. forums or channels, banned identities are kept in a list for some time. After that, they are &quot;cleared&quot; from the banning list, and will be downloaded again as unbanned if used in forus, chat rooms, etc.</p></body></html></string>
|
||||||
|
</property>
|
||||||
<property name="suffix">
|
<property name="suffix">
|
||||||
<string> days</string>
|
<string> days</string>
|
||||||
</property>
|
</property>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue