mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-06-09 07:02:41 -04:00
automatically close ongoing uploads when we stop sharing an extra file
This commit is contained in:
parent
2bd3fbf977
commit
9a440e077e
5 changed files with 30 additions and 4 deletions
|
@ -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 ********/
|
||||||
|
|
|
@ -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);
|
||||||
|
|
|
@ -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 ******/
|
||||||
|
|
|
@ -113,9 +113,9 @@ class ftDataMultiplex: public ftDataRecv, public RsQueueThread
|
||||||
bool FileDetails(const RsFileHash &hash, FileSearchFlags hintsflag, FileInfo &info);
|
bool FileDetails(const RsFileHash &hash, FileSearchFlags hintsflag, FileInfo &info);
|
||||||
|
|
||||||
void deleteUnusedServers() ;
|
void deleteUnusedServers() ;
|
||||||
|
bool deleteServer(const RsFileHash& hash); // deletes FtServers for the given hash. Used when removing an extra file from shares.
|
||||||
void handlePendingCrcRequests() ;
|
void handlePendingCrcRequests() ;
|
||||||
|
|
||||||
|
|
||||||
/*************** SEND INTERFACE (calls ftDataSend) *******************/
|
/*************** SEND INTERFACE (calls ftDataSend) *******************/
|
||||||
|
|
||||||
/* Client Send */
|
/* Client Send */
|
||||||
|
|
|
@ -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 )
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue