mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-06 16:15:23 -04:00
* HACK: fixed mem issues with file data - not ideal
* removed more debug: filedata prints. * removed rank/photo/games from setup for release (#define RS_RELEASE) git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@464 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
0a68ec6bee
commit
6c90e1ad67
5 changed files with 49 additions and 14 deletions
|
@ -496,14 +496,17 @@ int filedexserver::handleInputQueues()
|
|||
i_init = i;
|
||||
while((fr = pqisi -> GetFileRequest()) != NULL )
|
||||
{
|
||||
//std::cerr << "filedexserver::handleInputQueues() Recvd ftFiler Request" << std::endl;
|
||||
#ifdef SERVER_DEBUG
|
||||
std::cerr << "filedexserver::handleInputQueues() Recvd ftFiler Request" << std::endl;
|
||||
std::ostringstream out;
|
||||
if (i++ == i_init)
|
||||
if (i == i_init)
|
||||
{
|
||||
out << "Incoming(Net) File Item:" << std::endl;
|
||||
}
|
||||
fr -> print(out);
|
||||
pqioutput(PQL_DEBUG_BASIC, fldxsrvrzone, out.str());
|
||||
#endif
|
||||
i++; /* count */
|
||||
|
||||
/* This bit is for debugging only! (not really needed) */
|
||||
|
||||
|
@ -521,20 +524,23 @@ int filedexserver::handleInputQueues()
|
|||
while((fd = pqisi -> GetFileData()) != NULL )
|
||||
{
|
||||
//std::cerr << "filedexserver::handleInputQueues() Recvd ftFiler Data" << std::endl;
|
||||
#ifdef SERVER_DEBUG
|
||||
std::ostringstream out;
|
||||
if (i++ == i_init)
|
||||
if (i == i_init)
|
||||
{
|
||||
out << "Incoming(Net) File Data:" << std::endl;
|
||||
}
|
||||
fd -> print(out);
|
||||
pqioutput(PQL_DEBUG_BASIC, fldxsrvrzone, out.str());
|
||||
#endif
|
||||
i++; /* count */
|
||||
|
||||
/* incoming data */
|
||||
ftFileData *ffd = new ftFileData(fd->PeerId(),
|
||||
fd->fd.file.hash, fd->fd.file.filesize,
|
||||
fd->fd.file_offset,
|
||||
fd->fd.binData.bin_len,
|
||||
fd->fd.binData.bin_data);
|
||||
fd->fd.binData.bin_data, FT_FILEDATA_FLAG_NOFREE);
|
||||
|
||||
ftFiler->recvFileInfo(ffd);
|
||||
delete fd;
|
||||
|
|
|
@ -64,28 +64,38 @@ virtual ~ftFileRequest() { return; }
|
|||
uint32_t chunk;
|
||||
};
|
||||
|
||||
const uint32_t FT_FILEDATA_FLAG_NOFREE = 0x01;
|
||||
|
||||
class ftFileData: public ftFileRequest
|
||||
{
|
||||
public:
|
||||
ftFileData(std::string id_in, std::string hash_in,
|
||||
uint64_t size_in, uint64_t offset_in,
|
||||
uint32_t chunk_in, void *data_in)
|
||||
uint32_t chunk_in, void *data_in, uint32_t flags)
|
||||
:ftFileRequest(id_in, hash_in, size_in,
|
||||
offset_in, chunk_in), data(data_in)
|
||||
offset_in, chunk_in), data(data_in), ftFlags(flags)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
virtual ~ftFileData()
|
||||
{
|
||||
if (data)
|
||||
if (ftFlags & FT_FILEDATA_FLAG_NOFREE)
|
||||
{
|
||||
free(data);
|
||||
/* don't free */
|
||||
}
|
||||
else
|
||||
{
|
||||
if (data)
|
||||
{
|
||||
free(data);
|
||||
}
|
||||
}
|
||||
data = NULL;
|
||||
}
|
||||
|
||||
void *data;
|
||||
uint32_t ftFlags;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -997,7 +997,7 @@ int ftfiler::generateFileData(ftFileStatus *s, std::string id, uint64_t offset,
|
|||
}
|
||||
|
||||
// make a FileData type.
|
||||
ftFileData *fd = new ftFileData(id, s->hash, s->size, offset, tosend, data);
|
||||
ftFileData *fd = new ftFileData(id, s->hash, s->size, offset, tosend, data, 0);
|
||||
|
||||
/* send off the packet */
|
||||
out_queue.push_back(fd);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue