Merge pull request #2479 from csoler/v0.6-BugFixing_13

[WIP] Fixing a few bugs.
This commit is contained in:
csoler 2021-10-06 19:35:57 +02:00 committed by GitHub
commit 0deb83a5b9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 35 additions and 5 deletions

View File

@ -1541,6 +1541,11 @@ std::string ftController::getPartialsDirectory()
return mPartialsPath; return mPartialsPath;
} }
bool ftController::FileServerCancel(const RsFileHash& hash)
{
RsStackMutex stack(ctrlMutex); /******* LOCKED ********/
return mDataplex->deleteServer(hash);
}
bool ftController::setDestinationDirectory(const RsFileHash& hash,const std::string& dest_dir) bool ftController::setDestinationDirectory(const RsFileHash& hash,const std::string& dest_dir)
{ {
RsStackMutex stack(ctrlMutex); /******* LOCKED ********/ RsStackMutex stack(ctrlMutex); /******* LOCKED ********/

View File

@ -157,6 +157,7 @@ public:
bool getFileDownloadChunksDetails(const RsFileHash& hash,FileChunksInfo& info); bool getFileDownloadChunksDetails(const RsFileHash& hash,FileChunksInfo& info);
bool setDestinationName(const RsFileHash& hash,const std::string& dest_name) ; bool setDestinationName(const RsFileHash& hash,const std::string& dest_name) ;
bool setDestinationDirectory(const RsFileHash& hash,const std::string& dest_name) ; bool setDestinationDirectory(const RsFileHash& hash,const std::string& dest_name) ;
bool FileServerCancel(const RsFileHash& hash);
// Download speed // Download speed
bool getPriority(const RsFileHash& hash,DwlSpeed& p); bool getPriority(const RsFileHash& hash,DwlSpeed& p);

View File

@ -1039,6 +1039,23 @@ void ftDataMultiplex::handlePendingCrcRequests()
} }
} }
bool ftDataMultiplex::deleteServer(const RsFileHash& hash)
{
RsStackMutex stack(dataMtx); /******* LOCK MUTEX ******/
auto sit = mServers.find(hash);
if(sit == mServers.end())
return false;
// We don't delete servers that are clients at the same time !
if(dynamic_cast<ftFileCreator*>(sit->second) == NULL)
delete sit->second;
mServers.erase(sit);
return true;
}
void ftDataMultiplex::deleteUnusedServers() void ftDataMultiplex::deleteUnusedServers()
{ {
RsStackMutex stack(dataMtx); /******* LOCK MUTEX ******/ RsStackMutex stack(dataMtx); /******* LOCK MUTEX ******/

View File

@ -112,9 +112,9 @@ class ftDataMultiplex: public ftDataRecv, public RsQueueThread
bool FileDownloads(std::list<RsFileHash> &hashs); bool FileDownloads(std::list<RsFileHash> &hashs);
bool FileDetails(const RsFileHash &hash, FileSearchFlags hintsflag, FileInfo &info); bool FileDetails(const RsFileHash &hash, FileSearchFlags hintsflag, FileInfo &info);
void deleteUnusedServers() ; void deleteUnusedServers() ;
void handlePendingCrcRequests() ; bool deleteServer(const RsFileHash& hash); // deletes FtServers for the given hash. Used when removing an extra file from shares.
void handlePendingCrcRequests() ;
/*************** SEND INTERFACE (calls ftDataSend) *******************/ /*************** SEND INTERFACE (calls ftDataSend) *******************/

View File

@ -817,7 +817,10 @@ bool ftServer::ExtraFileAdd(std::string fname, const RsFileHash& hash, uint64_t
} }
bool ftServer::ExtraFileRemove(const RsFileHash& hash) bool ftServer::ExtraFileRemove(const RsFileHash& hash)
{ return mFileDatabase->removeExtraFile(hash); } {
mFtController->FileServerCancel(hash);
return mFileDatabase->removeExtraFile(hash);
}
bool ftServer::ExtraFileHash( std::string localpath, rstime_t period, TransferRequestFlags flags ) bool ftServer::ExtraFileHash( std::string localpath, rstime_t period, TransferRequestFlags flags )
{ {

View File

@ -45,6 +45,8 @@
#include "util/DateTime.h" #include "util/DateTime.h"
#include "util/misc.h" #include "util/misc.h"
#define FRIEND_OPTIONS_TAB_INDEX 2
QMap<RsPgpId, PGPKeyDialog*> PGPKeyDialog::instances_pgp; QMap<RsPgpId, PGPKeyDialog*> PGPKeyDialog::instances_pgp;
PGPKeyDialog *PGPKeyDialog::instance(const RsPgpId& pgp_id) PGPKeyDialog *PGPKeyDialog::instance(const RsPgpId& pgp_id)
@ -199,11 +201,13 @@ void PGPKeyDialog::load()
{ {
ui.make_friend_button->hide(); ui.make_friend_button->hide();
ui.denyFriendButton->show(); ui.denyFriendButton->show();
ui.stabWidget->setTabEnabled(FRIEND_OPTIONS_TAB_INDEX,true);
} }
else else
{ {
ui.make_friend_button->show(); ui.make_friend_button->show();
ui.denyFriendButton->hide(); ui.denyFriendButton->hide();
ui.stabWidget->setTabEnabled(FRIEND_OPTIONS_TAB_INDEX,false);
} }
//web of trust //web of trust

View File

@ -393,7 +393,7 @@ p, li { white-space: pre-wrap; }
</widget> </widget>
<widget class="QWidget" name="option_Tab"> <widget class="QWidget" name="option_Tab">
<attribute name="title"> <attribute name="title">
<string>Options</string> <string>Friend options</string>
</attribute> </attribute>
<layout class="QVBoxLayout" name="option_Tab_VL"> <layout class="QVBoxLayout" name="option_Tab_VL">
<item> <item>