mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-13 03:22:34 -04:00
time out unused uploads
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@932 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
5480354492
commit
812cdd6bd6
5 changed files with 31 additions and 1 deletions
|
@ -183,6 +183,30 @@ void ftServer::run()
|
|||
{
|
||||
while(1)
|
||||
{
|
||||
//scan the uploads list in ftdatamultiplex and delete the items which time out
|
||||
time_t now = time(NULL);
|
||||
FileInfo info;
|
||||
std::list<std::string> toDels;
|
||||
std::map<std::string, ftFileProvider *>::iterator sit;
|
||||
for(sit = mFtDataplex->mServers.begin(); sit != mFtDataplex->mServers.end(); sit++)
|
||||
{
|
||||
if (FileDetails(sit->first,RS_FILE_HINTS_UPLOAD,info))
|
||||
{
|
||||
if ((now - info.lastTS) > 5)
|
||||
{
|
||||
toDels.push_back(sit->first);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
std::list<std::string>::iterator it;
|
||||
for (it = toDels.begin();it != toDels.end(); it++)
|
||||
{
|
||||
sit = mFtDataplex->mServers.find(*it);
|
||||
mFtDataplex->mServers.erase(sit);
|
||||
delete sit->second;
|
||||
}
|
||||
|
||||
#ifdef WIN32
|
||||
Sleep(1000);
|
||||
#else
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue