mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-06-08 06:32:55 -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
|
@ -212,6 +212,7 @@ void RsServer::run()
|
||||||
|
|
||||||
|
|
||||||
/* Tick slow services */
|
/* Tick slow services */
|
||||||
|
if (mRanking)
|
||||||
mRanking->tick();
|
mRanking->tick();
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -67,6 +67,11 @@
|
||||||
|
|
||||||
#include "pqi/p3notify.h" // HACK - moved to pqi for compilation order.
|
#include "pqi/p3notify.h" // HACK - moved to pqi for compilation order.
|
||||||
|
|
||||||
|
|
||||||
|
// UNCOMMENT THIS FOR UNFINISHED SERVICES
|
||||||
|
#define RS_RELEASE 1
|
||||||
|
|
||||||
|
|
||||||
/**************** PQI_USE_XPGP ******************/
|
/**************** PQI_USE_XPGP ******************/
|
||||||
#if defined(PQI_USE_XPGP)
|
#if defined(PQI_USE_XPGP)
|
||||||
#include "pqi/authxpgp.h"
|
#include "pqi/authxpgp.h"
|
||||||
|
@ -525,18 +530,20 @@ int RsServer::StartupRetroShare(RsInit *config)
|
||||||
ad = new p3disc(mAuthMgr, mConnMgr);
|
ad = new p3disc(mAuthMgr, mConnMgr);
|
||||||
msgSrv = new p3MsgService(mConnMgr);
|
msgSrv = new p3MsgService(mConnMgr);
|
||||||
chatSrv = new p3ChatService(mConnMgr);
|
chatSrv = new p3ChatService(mConnMgr);
|
||||||
p3GameLauncher *gameLauncher = new p3GameLauncher(mConnMgr);
|
|
||||||
|
|
||||||
pqih -> addService(ad);
|
pqih -> addService(ad);
|
||||||
pqih -> addService(msgSrv);
|
pqih -> addService(msgSrv);
|
||||||
pqih -> addService(chatSrv);
|
pqih -> addService(chatSrv);
|
||||||
pqih -> addService(gameLauncher);
|
|
||||||
|
|
||||||
/* create Cache Services */
|
/* create Cache Services */
|
||||||
std::string config_dir = config->basedir;
|
std::string config_dir = config->basedir;
|
||||||
std::string localcachedir = config_dir + "/cache/local";
|
std::string localcachedir = config_dir + "/cache/local";
|
||||||
std::string remotecachedir = config_dir + "/cache/remote";
|
std::string remotecachedir = config_dir + "/cache/remote";
|
||||||
|
|
||||||
|
#ifndef RS_RELEASE
|
||||||
|
p3GameLauncher *gameLauncher = new p3GameLauncher(mConnMgr);
|
||||||
|
pqih -> addService(gameLauncher);
|
||||||
|
|
||||||
mRanking = new p3Ranking(mConnMgr, RS_SERVICE_TYPE_RANK,
|
mRanking = new p3Ranking(mConnMgr, RS_SERVICE_TYPE_RANK,
|
||||||
mCacheStrapper, mCacheTransfer,
|
mCacheStrapper, mCacheTransfer,
|
||||||
localcachedir, remotecachedir, 3600 * 24 * 30);
|
localcachedir, remotecachedir, 3600 * 24 * 30);
|
||||||
|
@ -550,6 +557,11 @@ int RsServer::StartupRetroShare(RsInit *config)
|
||||||
|
|
||||||
CachePair cp2(photoService, photoService, CacheId(RS_SERVICE_TYPE_PHOTO, 0));
|
CachePair cp2(photoService, photoService, CacheId(RS_SERVICE_TYPE_PHOTO, 0));
|
||||||
mCacheStrapper -> addCachePair(cp2);
|
mCacheStrapper -> addCachePair(cp2);
|
||||||
|
#else
|
||||||
|
mRanking = NULL;
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/**************************************************************************/
|
/**************************************************************************/
|
||||||
|
|
||||||
|
@ -692,11 +704,17 @@ int RsServer::StartupRetroShare(RsInit *config)
|
||||||
/* Setup GUI Interfaces. */
|
/* Setup GUI Interfaces. */
|
||||||
|
|
||||||
rsPeers = new p3Peers(mConnMgr, mAuthMgr);
|
rsPeers = new p3Peers(mConnMgr, mAuthMgr);
|
||||||
rsGameLauncher = gameLauncher;
|
|
||||||
rsRanks = new p3Rank(mRanking);
|
|
||||||
rsMsgs = new p3Msgs(mAuthMgr, msgSrv, chatSrv);
|
rsMsgs = new p3Msgs(mAuthMgr, msgSrv, chatSrv);
|
||||||
rsDisc = new p3Discovery(ad);
|
rsDisc = new p3Discovery(ad);
|
||||||
|
#ifndef RS_RELEASE
|
||||||
|
rsGameLauncher = gameLauncher;
|
||||||
rsPhoto = new p3Photo(photoService);
|
rsPhoto = new p3Photo(photoService);
|
||||||
|
rsRanks = new p3Rank(mRanking);
|
||||||
|
#else
|
||||||
|
rsGameLauncher = NULL;
|
||||||
|
rsPhoto = NULL;
|
||||||
|
rsRanks = NULL;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* put a welcome message in! */
|
/* put a welcome message in! */
|
||||||
|
|
|
@ -496,14 +496,17 @@ int filedexserver::handleInputQueues()
|
||||||
i_init = i;
|
i_init = i;
|
||||||
while((fr = pqisi -> GetFileRequest()) != NULL )
|
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;
|
std::ostringstream out;
|
||||||
if (i++ == i_init)
|
if (i == i_init)
|
||||||
{
|
{
|
||||||
out << "Incoming(Net) File Item:" << std::endl;
|
out << "Incoming(Net) File Item:" << std::endl;
|
||||||
}
|
}
|
||||||
fr -> print(out);
|
fr -> print(out);
|
||||||
pqioutput(PQL_DEBUG_BASIC, fldxsrvrzone, out.str());
|
pqioutput(PQL_DEBUG_BASIC, fldxsrvrzone, out.str());
|
||||||
|
#endif
|
||||||
|
i++; /* count */
|
||||||
|
|
||||||
/* This bit is for debugging only! (not really needed) */
|
/* This bit is for debugging only! (not really needed) */
|
||||||
|
|
||||||
|
@ -521,20 +524,23 @@ int filedexserver::handleInputQueues()
|
||||||
while((fd = pqisi -> GetFileData()) != NULL )
|
while((fd = pqisi -> GetFileData()) != NULL )
|
||||||
{
|
{
|
||||||
//std::cerr << "filedexserver::handleInputQueues() Recvd ftFiler Data" << std::endl;
|
//std::cerr << "filedexserver::handleInputQueues() Recvd ftFiler Data" << std::endl;
|
||||||
|
#ifdef SERVER_DEBUG
|
||||||
std::ostringstream out;
|
std::ostringstream out;
|
||||||
if (i++ == i_init)
|
if (i == i_init)
|
||||||
{
|
{
|
||||||
out << "Incoming(Net) File Data:" << std::endl;
|
out << "Incoming(Net) File Data:" << std::endl;
|
||||||
}
|
}
|
||||||
fd -> print(out);
|
fd -> print(out);
|
||||||
pqioutput(PQL_DEBUG_BASIC, fldxsrvrzone, out.str());
|
pqioutput(PQL_DEBUG_BASIC, fldxsrvrzone, out.str());
|
||||||
|
#endif
|
||||||
|
i++; /* count */
|
||||||
|
|
||||||
/* incoming data */
|
/* incoming data */
|
||||||
ftFileData *ffd = new ftFileData(fd->PeerId(),
|
ftFileData *ffd = new ftFileData(fd->PeerId(),
|
||||||
fd->fd.file.hash, fd->fd.file.filesize,
|
fd->fd.file.hash, fd->fd.file.filesize,
|
||||||
fd->fd.file_offset,
|
fd->fd.file_offset,
|
||||||
fd->fd.binData.bin_len,
|
fd->fd.binData.bin_len,
|
||||||
fd->fd.binData.bin_data);
|
fd->fd.binData.bin_data, FT_FILEDATA_FLAG_NOFREE);
|
||||||
|
|
||||||
ftFiler->recvFileInfo(ffd);
|
ftFiler->recvFileInfo(ffd);
|
||||||
delete fd;
|
delete fd;
|
||||||
|
|
|
@ -64,28 +64,38 @@ virtual ~ftFileRequest() { return; }
|
||||||
uint32_t chunk;
|
uint32_t chunk;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const uint32_t FT_FILEDATA_FLAG_NOFREE = 0x01;
|
||||||
|
|
||||||
class ftFileData: public ftFileRequest
|
class ftFileData: public ftFileRequest
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ftFileData(std::string id_in, std::string hash_in,
|
ftFileData(std::string id_in, std::string hash_in,
|
||||||
uint64_t size_in, uint64_t offset_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,
|
:ftFileRequest(id_in, hash_in, size_in,
|
||||||
offset_in, chunk_in), data(data_in)
|
offset_in, chunk_in), data(data_in), ftFlags(flags)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual ~ftFileData()
|
virtual ~ftFileData()
|
||||||
|
{
|
||||||
|
if (ftFlags & FT_FILEDATA_FLAG_NOFREE)
|
||||||
|
{
|
||||||
|
/* don't free */
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
if (data)
|
if (data)
|
||||||
{
|
{
|
||||||
free(data);
|
free(data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
data = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
void *data;
|
void *data;
|
||||||
|
uint32_t ftFlags;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -997,7 +997,7 @@ int ftfiler::generateFileData(ftFileStatus *s, std::string id, uint64_t offset,
|
||||||
}
|
}
|
||||||
|
|
||||||
// make a FileData type.
|
// 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 */
|
/* send off the packet */
|
||||||
out_queue.push_back(fd);
|
out_queue.push_back(fd);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue