Fixed compatibility bug in file transfer...

can now communicate between V0.4.9b and V0.4.11+



git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@827 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
drbob 2008-11-20 22:59:58 +00:00
parent 7c596231e1
commit 71797d6f70
4 changed files with 5 additions and 4 deletions

View File

@ -40,7 +40,7 @@ hash, uint64_t recvd): ftFileProvider(path,size,hash)
} }
bool ftFileCreator::getFileData(uint64_t offset, bool ftFileCreator::getFileData(uint64_t offset,
uint32_t chunk_size, void *data) uint32_t &chunk_size, void *data)
{ {
{ {
RsStackMutex stack(ftcMutex); /********** STACK LOCKED MTX ******/ RsStackMutex stack(ftcMutex); /********** STACK LOCKED MTX ******/

View File

@ -45,7 +45,7 @@ public:
~ftFileCreator(); ~ftFileCreator();
/* overloaded from FileProvider */ /* overloaded from FileProvider */
virtual bool getFileData(uint64_t offset, uint32_t chunk_size, void *data); virtual bool getFileData(uint64_t offset, uint32_t &chunk_size, void *data);
bool finished() { return getRecvd() == getFileSize(); } bool finished() { return getRecvd() == getFileSize(); }
uint64_t getRecvd(); uint64_t getRecvd();

View File

@ -46,7 +46,7 @@ bool ftFileProvider::FileDetails(FileInfo &info)
} }
bool ftFileProvider::getFileData(uint64_t offset, uint32_t chunk_size, void *data) bool ftFileProvider::getFileData(uint64_t offset, uint32_t &chunk_size, void *data)
{ {
/* dodgey checking outside of mutex... /* dodgey checking outside of mutex...
* much check again inside FileAttrs(). * much check again inside FileAttrs().
@ -71,6 +71,7 @@ bool ftFileProvider::getFileData(uint64_t offset, uint32_t chunk_size, void *dat
if (base_loc + data_size > mSize) if (base_loc + data_size > mSize)
{ {
data_size = mSize - base_loc; data_size = mSize - base_loc;
chunk_size = mSize - base_loc;
std::cerr <<"Chunk Size greater than total file size, adjusting chunk size " << data_size << std::endl; std::cerr <<"Chunk Size greater than total file size, adjusting chunk size " << data_size << std::endl;
} }

View File

@ -41,7 +41,7 @@ public:
ftFileProvider(std::string path, uint64_t size, std::string hash); ftFileProvider(std::string path, uint64_t size, std::string hash);
virtual ~ftFileProvider(); virtual ~ftFileProvider();
virtual bool getFileData(uint64_t offset, uint32_t chunk_size, void *data); virtual bool getFileData(uint64_t offset, uint32_t &chunk_size, void *data);
virtual bool FileDetails(FileInfo &info); virtual bool FileDetails(FileInfo &info);
std::string getHash(); std::string getHash();
uint64_t getFileSize(); uint64_t getFileSize();