corrected the file copy error (see trunk commit 3261

git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5.0@3266 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
csoler 2010-07-07 21:48:59 +00:00
parent f082b0b45f
commit d786eda784

View file

@ -102,6 +102,8 @@ bool ftFileCreator::addFileData(uint64_t offset, uint32_t chunk_size, void *data
if(!RsDiscSpace::checkForDiscSpace(RS_PARTIALS_DIRECTORY)) if(!RsDiscSpace::checkForDiscSpace(RS_PARTIALS_DIRECTORY))
return false ; return false ;
bool complete = false ;
{
RsStackMutex stack(ftcMutex); /********** STACK LOCKED MTX ******/ RsStackMutex stack(ftcMutex); /********** STACK LOCKED MTX ******/
if (fd == NULL) if (fd == NULL)
@ -145,6 +147,16 @@ bool ftFileCreator::addFileData(uint64_t offset, uint32_t chunk_size, void *data
* Notify ftFileChunker about chunks received * Notify ftFileChunker about chunks received
*/ */
locked_notifyReceived(offset,chunk_size); locked_notifyReceived(offset,chunk_size);
complete = chunkMap.isComplete() ;
}
if(complete)
{
#ifdef FILE_DEBUG
std::cerr << "ftFileCreator::addFileData() File is complete: closing" << std::endl ;
#endif
closeFile();
}
/* /*
* FIXME HANDLE COMPLETION HERE - Any better way? * FIXME HANDLE COMPLETION HERE - Any better way?