improved banned files UI and fixed deadlock

This commit is contained in:
csoler 2018-08-25 20:18:54 +02:00
parent c14d898901
commit b5eabf7af7
No known key found for this signature in database
GPG Key ID: 7BCA522266C0804C
2 changed files with 15 additions and 7 deletions

View File

@ -185,15 +185,19 @@ int p3FileDatabase::tick()
if(last_print_time + 20 < now)
{
RS_STACK_MUTEX(mFLSMtx) ;
{
RS_STACK_MUTEX(mFLSMtx) ;
#ifdef DEBUG_FILE_HIERARCHY
mLocalSharedDirs->print();
mLocalSharedDirs->print();
#endif
last_print_time = now ;
last_print_time = now ;
}
#warning mr-alice 2016-08-19: "This should be removed, but it's necessary atm for updating the GUI"
RsServer::notify()->notifyListChange(NOTIFY_LIST_DIRLIST_LOCAL, 0);
checkSendBannedFilesInfo();
}
if(mUpdateFlags)
@ -1939,13 +1943,17 @@ bool p3FileDatabase::isFileBanned(const RsFileHash& hash)
{
RS_STACK_MUTEX(mFLSMtx) ;
if(mBannedFileList.empty()) // quick exit
return false ;
RsFileHash hash_of_hash ;
ftServer::encryptHash(hash,hash_of_hash) ;
bool res = mBannedFileList.find(hash) != mBannedFileList.end() || mBannedFileList.find(hash_of_hash) != mBannedFileList.end() ;
#ifdef DEBUG_CONTENT_FILTERING
P3FILELISTS_DEBUG() << " is file banned(" << hash << "): " << (res?"YES":"NO") << std::endl;
if(res)
P3FILELISTS_DEBUG() << " is file banned(" << hash << "): " << (res?"YES":"NO") << std::endl;
#endif
return res ;
}
@ -2014,7 +2022,7 @@ void p3FileDatabase::checkSendBannedFilesInfo()
it->second.mLastSent = now;
}
peers.erase(it->first); // friend has been handled -> remove from list
peers.erase(it->first); // friend has been handled -> remove from list
++it;
}
@ -2084,7 +2092,7 @@ void p3FileDatabase::locked_sendBanInfo(const RsPeerId& peer)
if(!item)
{
RsFileListsBannedHashesItem *item = new RsFileListsBannedHashesItem ;
item = new RsFileListsBannedHashesItem ;
item->PeerId(peer);
item->session_id = session_id ;

View File

@ -14,7 +14,7 @@
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;The list below contains files you have chosen to ban from your local network. You will not forward search results and data from these files to your friends. This list is securely shared with your friends, unless they uncheck option &amp;quot;Trust my friends for banning unwanted content&amp;quot;.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;Collaborative file control&lt;/span&gt;: the list below contains files you choose to ban from your &lt;span style=&quot; font-weight:600;&quot;&gt;local&lt;/span&gt; network: you will not forward search results nor data from these files to your friends. This list is securely shared with your friends, unless they uncheck option &amp;quot;Trust my friends for banning unwanted content&amp;quot;. This feature cannot globally hide a file unless a signficant proportion of users in the same network decide to ban it.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="alignment">
<set>Qt::AlignJustify|Qt::AlignVCenter</set>