Modifications to bring in the new serialiser:

- Switched to 64 bit lengths for files.
- Switched to new data types (RsItem).
- Moved Msg and Chat to services.



git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@275 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
drbob 2007-12-12 01:39:09 +00:00
parent 2c9c31eaf0
commit d9efb76b01
9 changed files with 385 additions and 753 deletions

View File

@ -2,8 +2,8 @@
RS_TOP_DIR = .. RS_TOP_DIR = ..
include ../make.opt include ../make.opt
OBJ = filedexserver.o pqifiler.o \ OBJ = ft.o ftfiler.o hashsearch.o \
ft.o ftfiler.o hashsearch.o filedexserver.o
EXEC = ftcachetest EXEC = ftcachetest

File diff suppressed because it is too large Load Diff

View File

@ -49,6 +49,7 @@
#include "pqi/pqi.h" #include "pqi/pqi.h"
#include "pqi/pqiindic.h" #include "pqi/pqiindic.h"
#include "serialiser/rsconfigitems.h"
#include <map> #include <map>
#include <deque> #include <deque>
#include <list> #include <list>
@ -82,23 +83,25 @@ class filedexserver
void loadWelcomeMsg(); /* startup message */ void loadWelcomeMsg(); /* startup message */
int setSearchInterface(P3Interface *si, sslroot *sr); int setSearchInterface(P3Interface *si, sslroot *sr);
int additem(SearchItem *item, char *fname); //int additem(SearchItem *item, char *fname);
int sendChat(std::string msg); //int sendChat(std::string msg);
int sendPrivateChat(ChatItem *ci); //int sendPrivateChat(ChatItem *ci);
int sendRecommend(PQFileItem *fi, std::string msg); //int sendRecommend(PQFileItem *fi, std::string msg);
int sendMessage(MsgItem *item); //int sendMessage(MsgItem *item);
int checkOutgoingMessages(); //int checkOutgoingMessages();
int getChat(); //int getChat();
/* std::deque<std::string> &getChatQueue(); */ /* std::deque<std::string> &getChatQueue(); */
std::list<ChatItem *> getChatQueue(); //std::list<ChatItem *> getChatQueue();
std::list<MsgItem *> &getMsgList(); //std::list<MsgItem *> &getMsgList();
std::list<MsgItem *> &getMsgOutList(); //std::list<MsgItem *> &getMsgOutList();
std::list<MsgItem *> getNewMsgs(); //std::list<MsgItem *> getNewMsgs();
std::list<FileTransferItem *> getTransfers();
std::list<RsFileTransfer *> getTransfers();
// get files (obsolete?) // get files (obsolete?)
int getFile(std::string fname, std::string hash, int getFile(std::string fname, std::string hash,
@ -107,12 +110,12 @@ void clear_old_transfers();
void cancelTransfer(std::string fname, std::string hash, uint32_t size); void cancelTransfer(std::string fname, std::string hash, uint32_t size);
// cleaning up.... // cleaning up....
int removeMsgItem(int itemnum); //int removeMsgItem(int itemnum);
// alternative versions. // alternative versions.
int removeMsgItem(MsgItem *mi); //int removeMsgItem(MsgItem *mi);
// third versions. // third versions.
int removeMsgId(unsigned long mid); /* id stored in sid */ //int removeMsgId(unsigned long mid); /* id stored in sid */
int markMsgIdRead(unsigned long mid); //int markMsgIdRead(unsigned long mid);
// access to search info is also required. // access to search info is also required.
@ -134,20 +137,17 @@ void setSaveIncSearch(bool v);
int tick(); int tick();
int status(); int status();
private: private:
int handleInputQueues(); int handleInputQueues();
int handleOutputQueues(); int handleOutputQueues();
std::list<ChatItem *> ichat;
std::list<MsgItem *> imsg;
std::list<MsgItem *> nmsg;
std::list<MsgItem *> msgOutgoing; /* ones that haven't made it out yet! */
std::list<std::string> dbase_dirs; std::list<std::string> dbase_dirs;
P3Interface *pqisi; sslroot *sslr;
sslroot *sslr;
P3Interface *pqisi;
std::string config_dir; std::string config_dir;
std::string save_dir; std::string save_dir;
@ -155,23 +155,23 @@ bool save_inc; // is savedir include in share list.
// bool state flags. // bool state flags.
public: public:
Indicator msgChanged; // Indicator msgChanged;
Indicator msgMajorChanged; // Indicator msgMajorChanged;
Indicator chatChanged; // Indicator chatChanged;
#ifdef PQI_USE_CHANNELS #ifdef PQI_USE_CHANNELS
public: public:
// Channel stuff. // Channel stuff.
void setP3Channel(p3channel *p3c); //void setP3Channel(p3channel *p3c);
int getAvailableChannels(std::list<pqichannel *> &chans); //int getAvailableChannels(std::list<pqichannel *> &chans);
int getChannelMsgList(channelSign s, std::list<chanMsgSummary> &summary); //int getChannelMsgList(channelSign s, std::list<chanMsgSummary> &summary);
channelMsg *getChannelMsg(channelSign s, MsgHash mh); //channelMsg *getChannelMsg(channelSign s, MsgHash mh);
Indicator channelsChanged; // everything! // Indicator channelsChanged; // everything!
private: private:
p3channel *p3chan; //p3channel *p3chan;
#endif #endif

View File

@ -26,7 +26,7 @@
#include "server/ft.h" #include "server/ft.h"
bool ftManager::lookupLocalHash(std::string hash, std::string &path, uint32_t &size) bool ftManager::lookupLocalHash(std::string hash, std::string &path, uint64_t &size)
{ {
std::list<FileDetail> details; std::list<FileDetail> details;

View File

@ -30,12 +30,13 @@
* ftManager - virtual base class for FileTransfer * ftManager - virtual base class for FileTransfer
*/ */
#include "pqi/pqi.h"
#include <list> #include <list>
#include <iostream> #include <iostream>
#include <string> #include <string>
#include "pqi/pqi.h"
#include "serialiser/rsconfigitems.h"
#include "dbase/cachestrapper.h" #include "dbase/cachestrapper.h"
#include "server/hashsearch.h" #include "server/hashsearch.h"
@ -46,7 +47,7 @@ class ftFileRequest
{ {
public: public:
ftFileRequest(std::string id_in, std::string hash_in, ftFileRequest(std::string id_in, std::string hash_in,
uint32_t size_in, uint32_t offset_in, uint64_t size_in, uint64_t offset_in,
uint32_t chunk_in) uint32_t chunk_in)
:id(id_in), hash(hash_in), size(size_in), :id(id_in), hash(hash_in), size(size_in),
offset(offset_in), chunk(chunk_in) offset(offset_in), chunk(chunk_in)
@ -58,8 +59,8 @@ virtual ~ftFileRequest() { return; }
std::string id; std::string id;
std::string hash; std::string hash;
uint32_t size; uint64_t size;
uint32_t offset; uint64_t offset;
uint32_t chunk; uint32_t chunk;
}; };
@ -68,7 +69,7 @@ class ftFileData: public ftFileRequest
{ {
public: public:
ftFileData(std::string id_in, std::string hash_in, ftFileData(std::string id_in, std::string hash_in,
uint32_t size_in, uint32_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)
: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)
@ -103,16 +104,16 @@ void setFileHashSearch(FileHashSearch *hs) { fhs = hs; }
/*********** overloaded from CacheTransfer ***************/ /*********** overloaded from CacheTransfer ***************/
/* Must callback after this fn - using utility functions */ /* Must callback after this fn - using utility functions */
//virtual bool RequestCacheFile(RsPeerId id, std::string path, //virtual bool RequestCacheFile(RsPeerId id, std::string path,
// std::string hash, uint32_t size); // std::string hash, uint64_t size);
/******************* GUI Interface ************************/ /******************* GUI Interface ************************/
virtual int getFile(std::string name, std::string hash, virtual int getFile(std::string name, std::string hash,
uint32_t size, std::string destpath) = 0; uint64_t size, std::string destpath) = 0;
virtual int cancelFile(std::string hash) = 0; virtual int cancelFile(std::string hash) = 0;
virtual int clearFailedTransfers() = 0; virtual int clearFailedTransfers() = 0;
virtual int tick() = 0; virtual int tick() = 0;
virtual std::list<FileTransferItem *> getStatus() = 0; virtual std::list<RsFileTransfer *> getStatus() = 0;
/************* Network Interface****************************/ /************* Network Interface****************************/
@ -126,7 +127,7 @@ virtual ftFileRequest * sendFileInfo() = 0;
/****************** UTILITY FUNCTIONS ********************/ /****************** UTILITY FUNCTIONS ********************/
/* combines two lookup functions */ /* combines two lookup functions */
bool lookupLocalHash(std::string hash, std::string &path, uint32_t &size); bool lookupLocalHash(std::string hash, std::string &path, uint64_t &size);
bool lookupRemoteHash(std::string hash, std::list<std::string> &ids); bool lookupRemoteHash(std::string hash, std::list<std::string> &ids);
/*********** callback from CacheTransfer ***************/ /*********** callback from CacheTransfer ***************/
@ -142,3 +143,12 @@ bool lookupRemoteHash(std::string hash, std::list<std::string> &ids);
}; };
#endif #endif

View File

@ -61,19 +61,19 @@ const int ftfilerzone = 86539;
* *
*/ */
const int PQIFILE_OFFLINE_CHECK = 120; /* check every 2 minutes */ const uint32_t PQIFILE_OFFLINE_CHECK = 120; /* check every 2 minutes */
const int PQIFILE_DOWNLOAD_TIMEOUT = 60; /* time it out, -> offline after 60 secs */ const uint32_t PQIFILE_DOWNLOAD_TIMEOUT = 60; /* time it out, -> offline after 60 secs */
const int PQIFILE_DOWNLOAD_CHECK = 10; /* desired delta = 10 secs */ const uint32_t PQIFILE_DOWNLOAD_CHECK = 10; /* desired delta = 10 secs */
const int PQIFILE_DOWNLOAD_TOO_FAST = 8; /* 8 secs */ const uint32_t PQIFILE_DOWNLOAD_TOO_FAST = 8; /* 8 secs */
const int PQIFILE_DOWNLOAD_TOO_SLOW = 12; /* 12 secs */ const uint32_t PQIFILE_DOWNLOAD_TOO_SLOW = 12; /* 12 secs */
const int PQIFILE_DOWNLOAD_MIN_DELTA = 5; /* 5 secs */ const uint32_t PQIFILE_DOWNLOAD_MIN_DELTA = 5; /* 5 secs */
const float TRANSFER_MODE_TRICKLE_RATE = 1000; /* 1 kbyte limit */ const float TRANSFER_MODE_TRICKLE_RATE = 1000; /* 1 kbyte limit */
const float TRANSFER_MODE_NORMAL_RATE = 500000; /* 500 kbyte limit - everyone uses this one for now */ const float TRANSFER_MODE_NORMAL_RATE = 500000; /* 500 kbyte limit - everyone uses this one for now */
const float TRANSFER_MODE_FAST_RATE = 500000; /* 500 kbyte limit */ const float TRANSFER_MODE_FAST_RATE = 500000; /* 500 kbyte limit */
const int TRANSFER_START_MIN = 500; /* 500 byte min limit */ const uint32_t TRANSFER_START_MIN = 500; /* 500 byte min limit */
const int TRANSFER_START_MAX = 10000; /* 10000 byte max limit */ const uint32_t TRANSFER_START_MAX = 10000; /* 10000 byte max limit */
void printFtFileStatus(ftFileStatus *s, std::ostream &out); void printFtFileStatus(ftFileStatus *s, std::ostream &out);
@ -93,7 +93,7 @@ void printFtFileStatus(ftFileStatus *s, std::ostream &out);
int ftfiler::getFile(std::string name, std::string hash, int ftfiler::getFile(std::string name, std::string hash,
uint32_t size, std::string destpath) uint64_t size, std::string destpath)
{ {
/* add to local queue */ /* add to local queue */
{ {
@ -141,7 +141,7 @@ int ftfiler::getFile(std::string name, std::string hash,
return 1; return 1;
} }
bool ftfiler::RequestCacheFile(std::string id, std::string destpath, std::string hash, uint32_t size) bool ftfiler::RequestCacheFile(std::string id, std::string destpath, std::string hash, uint64_t size)
{ {
/* add to local queue */ /* add to local queue */
{ {
@ -307,72 +307,147 @@ int ftfiler::clearFailedTransfers()
return 1; return 1;
} }
std::list<FileTransferItem *> ftfiler::getStatus() std::list<RsFileTransfer *> ftfiler::getStatus()
{ {
pqioutput(PQL_DEBUG_BASIC, ftfilerzone, pqioutput(PQL_DEBUG_BASIC, ftfilerzone,
"ftfiler::getTransferStatus()"); "ftfiler::getTransferStatus()");
std::list<FileTransferItem *> stateList; std::list<RsFileTransfer *> stateList;
/* iterate through all files to recv */ /* iterate through all files to recv */
std::list<ftFileStatus *>::iterator it; std::list<ftFileStatus *>::iterator it;
for(it = recvFiles.begin(); it != recvFiles.end(); it++) for(it = recvFiles.begin(); it != recvFiles.end(); it++)
{ {
FileTransferItem *fti = new FileTransferItem(); RsFileTransfer *rft = new RsFileTransfer();
rft -> in = true;
/* fill in the basics /* Ids: current and all */
* HACK - note - current system cannot save without a cert! std::list<std::string>::iterator pit;
* - so use ours! for(pit = (*it)->sources.begin();
*/ pit != (*it)->sources.end(); pit++)
fti -> p = getSSLRoot()->getOwnCert();
fti -> name = (*it)->name;
/* hack to only store 'Real' Transfers (Cache have blank hash value)*/
if ((*it)->ftMode != FT_MODE_CACHE)
{ {
fti -> hash = (*it)->hash; rft->allPeerIds.ids.push_back(*pit);
} }
fti -> size = (*it)->size; rft -> cPeerId = (*it)->id;
/* file details */
rft -> file.name = (*it)->name;
rft -> file.filesize = (*it)->size;
rft -> file.path = "";
rft -> file.pop = 0;
rft -> file.age = 0;
/* hack to store 'Real' Transfers (Cache have blank hash)*/
if ((*it)->ftMode != FT_MODE_CACHE)
rft -> file.hash = (*it)->hash;
else
rft -> file.hash = "";
/* Fill in rate and State */ /* Fill in rate and State */
fti -> transferred = (*it)->recv_size; rft -> transferred = (*it)->recv_size;
fti -> crate = (*it)->rate / 1000.0; // kbytes. rft -> crate = (*it)->rate; // bytes.
fti -> trate = (*it)->rate / 1000.0; // kbytes. rft -> trate = (*it)->rate; // bytes.
fti -> lrate = (*it)->rate / 1000.0; // kbytes. rft -> lrate = (*it)->rate; // bytes.
fti -> ltransfer = (*it)->req_size; rft -> ltransfer = (*it)->req_size;
fti -> in = true;
/* get inactive period */ /* get inactive period */
if ((*it) -> status == PQIFILE_NOT_ONLINE) if ((*it) -> status == PQIFILE_NOT_ONLINE)
{ {
fti -> crate = 0; rft -> crate = 0;
fti -> trate = 0; rft -> trate = 0;
fti -> lrate = 0; rft -> lrate = 0;
fti -> ltransfer = 0; rft -> ltransfer = 0;
fti -> state = FT_STATE_OKAY; rft -> state = FT_STATE_WAITING;
} }
else if ((*it) -> status & PQIFILE_FAIL) else if ((*it) -> status & PQIFILE_FAIL)
{ {
fti -> crate = 0; rft -> crate = 0;
fti -> trate = 0; rft -> trate = 0;
fti -> lrate = 0; rft -> lrate = 0;
fti -> ltransfer = 0; rft -> ltransfer = 0;
fti -> state = FT_STATE_FAILED; rft -> state = FT_STATE_FAILED;
} }
else if ((*it) -> status == PQIFILE_COMPLETE) else if ((*it) -> status == PQIFILE_COMPLETE)
{ {
fti -> state = FT_STATE_COMPLETE; rft -> state = FT_STATE_COMPLETE;
} }
else if ((*it) -> status == PQIFILE_DOWNLOADING) else if ((*it) -> status == PQIFILE_DOWNLOADING)
{ {
fti -> state = FT_STATE_OKAY; rft -> state = FT_STATE_DOWNLOADING;
} }
else else
{ {
fti -> state = FT_STATE_FAILED; rft -> state = FT_STATE_FAILED;
} }
stateList.push_back(fti); stateList.push_back(rft);
}
/* outgoing files */
for(it = fileCache.begin(); it != fileCache.end(); it++)
{
RsFileTransfer *rft = new RsFileTransfer();
rft -> in = false;
/* Ids: current and all */
std::list<std::string>::iterator pit;
for(pit = (*it)->sources.begin();
pit != (*it)->sources.end(); pit++)
{
rft->allPeerIds.ids.push_back(*pit);
}
rft -> cPeerId = (*it)->id;
/* file details */
rft -> file.name = (*it)->name;
rft -> file.filesize = (*it)->size;
rft -> file.path = "";
rft -> file.pop = 0;
rft -> file.age = 0;
/* hack to store 'Real' Transfers (Cache have blank hash)*/
if ((*it)->ftMode != FT_MODE_CACHE)
rft -> file.hash = (*it)->hash;
else
rft -> file.hash = "";
/* Fill in rate and State */
rft -> transferred = (*it)->recv_size;
rft -> crate = (*it)->rate; // bytes.
rft -> trate = (*it)->rate; // bytes.
rft -> lrate = (*it)->rate; // bytes.
rft -> ltransfer = (*it)->req_size;
/* get inactive period */
if ((*it) -> status == PQIFILE_NOT_ONLINE)
{
rft -> crate = 0;
rft -> trate = 0;
rft -> lrate = 0;
rft -> ltransfer = 0;
rft -> state = FT_STATE_WAITING;
}
else if ((*it) -> status & PQIFILE_FAIL)
{
rft -> crate = 0;
rft -> trate = 0;
rft -> lrate = 0;
rft -> ltransfer = 0;
rft -> state = FT_STATE_FAILED;
}
else if ((*it) -> status == PQIFILE_COMPLETE)
{
rft -> state = FT_STATE_COMPLETE;
}
else if ((*it) -> status == PQIFILE_DOWNLOADING)
{
rft -> state = FT_STATE_DOWNLOADING;
}
else
{
rft -> state = FT_STATE_FAILED;
}
stateList.push_back(rft);
} }
return stateList; return stateList;
} }
@ -473,7 +548,7 @@ int ftfiler::handleFileNotAvailable(std::string hash)
} }
int ftfiler::handleFileData(std::string hash, uint32_t offset, int ftfiler::handleFileData(std::string hash, uint64_t offset,
void *data, uint32_t datalen) void *data, uint32_t datalen)
{ {
pqioutput(PQL_DEBUG_BASIC, ftfilerzone, pqioutput(PQL_DEBUG_BASIC, ftfilerzone,
@ -512,7 +587,7 @@ int ftfiler::handleFileData(std::string hash, uint32_t offset,
return 1; return 1;
} }
int ftfiler::handleFileRequest(std::string id, std::string hash, uint32_t offset, uint32_t chunk) int ftfiler::handleFileRequest(std::string id, std::string hash, uint64_t offset, uint32_t chunk)
{ {
pqioutput(PQL_DEBUG_BASIC, ftfilerzone, pqioutput(PQL_DEBUG_BASIC, ftfilerzone,
"ftfiler::handleFileRequest()"); "ftfiler::handleFileRequest()");
@ -539,7 +614,7 @@ int ftfiler::handleFileRequest(std::string id, std::string hash, uint32_t offset
return handleFileCacheRequest(id, hash, offset, chunk); return handleFileCacheRequest(id, hash, offset, chunk);
} }
int ftfiler::handleFileCacheRequest(std::string id, std::string hash, uint32_t offset, uint32_t chunk) int ftfiler::handleFileCacheRequest(std::string id, std::string hash, uint64_t offset, uint32_t chunk)
{ {
pqioutput(PQL_DEBUG_BASIC, ftfilerzone, pqioutput(PQL_DEBUG_BASIC, ftfilerzone,
"ftfiler::handleFileCacheRequest()"); "ftfiler::handleFileCacheRequest()");
@ -828,7 +903,7 @@ int ftfiler::requestData(ftFileStatus *item)
*/ */
int ftfiler::generateFileData(ftFileStatus *s, std::string id, uint32_t offset, uint32_t chunk) int ftfiler::generateFileData(ftFileStatus *s, std::string id, uint64_t offset, uint32_t chunk)
{ {
pqioutput(PQL_DEBUG_BASIC, ftfilerzone, pqioutput(PQL_DEBUG_BASIC, ftfilerzone,
"ftfiler::generateFileData()"); "ftfiler::generateFileData()");
@ -1128,7 +1203,7 @@ int ftfiler::resetFileTransfer(ftFileStatus *state)
int ftfiler::addFileData(ftFileStatus *s, long idx, void *data, int size) int ftfiler::addFileData(ftFileStatus *s, uint64_t idx, void *data, uint32_t size)
{ {
pqioutput(PQL_DEBUG_BASIC, ftfilerzone, pqioutput(PQL_DEBUG_BASIC, ftfilerzone,
"ftfiler::addFileData()"); "ftfiler::addFileData()");
@ -1265,7 +1340,7 @@ ftFileStatus *ftfiler::createFileCache(std::string hash)
/* so look it up! */ /* so look it up! */
std::string srcpath; std::string srcpath;
uint32_t size; uint64_t size;
if (lookupLocalHash(s->hash, srcpath, size)) if (lookupLocalHash(s->hash, srcpath, size))
{ {
found = true; found = true;

View File

@ -78,7 +78,7 @@ public:
} }
****/ ****/
ftFileStatus(std::string name_in, std::string hash_in, uint32_t size_in, ftFileStatus(std::string name_in, std::string hash_in, uint64_t size_in,
std::string destpath_in, uint32_t mode_in) std::string destpath_in, uint32_t mode_in)
:name(name_in), hash(hash_in), destpath(destpath_in), size(size_in), ftMode(mode_in), :name(name_in), hash(hash_in), destpath(destpath_in), size(size_in), ftMode(mode_in),
status(PQIFILE_INIT), mode(0), rate(0), fd(NULL), total_size(0), recv_size(0), status(PQIFILE_INIT), mode(0), rate(0), fd(NULL), total_size(0), recv_size(0),
@ -92,7 +92,7 @@ public:
return; return;
} }
ftFileStatus(std::string id_in, std::string name_in, std::string hash_in, uint32_t size_in, ftFileStatus(std::string id_in, std::string name_in, std::string hash_in, uint64_t size_in,
std::string destpath_in, uint32_t mode_in) std::string destpath_in, uint32_t mode_in)
:id(id_in), name(name_in), hash(hash_in), destpath(destpath_in), size(size_in), ftMode(mode_in), :id(id_in), name(name_in), hash(hash_in), destpath(destpath_in), size(size_in), ftMode(mode_in),
status(PQIFILE_INIT), mode(0), rate(0), fd(NULL), total_size(0), recv_size(0), status(PQIFILE_INIT), mode(0), rate(0), fd(NULL), total_size(0), recv_size(0),
@ -119,7 +119,7 @@ public:
std::string name; std::string name;
std::string hash; std::string hash;
std::string destpath; std::string destpath;
uint32_t size; uint64_t size;
/* new stuff */ /* new stuff */
uint32_t ftMode; uint32_t ftMode;
@ -133,18 +133,18 @@ public:
std::string file_name; std::string file_name;
FILE *fd; FILE *fd;
long total_size; uint64_t total_size;
/* this is the simplistic case where only inorder data /* this is the simplistic case where only inorder data
* otherwise - need much more status info */ * otherwise - need much more status info */
long recv_size; uint64_t recv_size;
/* current file data request */ /* current file data request */
long req_loc; uint64_t req_loc;
int req_size; uint32_t req_size;
/* timestamp */ /* timestamp */
long lastTS; time_t lastTS;
int lastDelta; /* send til all recved */ uint32_t lastDelta; /* send til all recved */
}; };
@ -158,15 +158,15 @@ public:
virtual ~ftfiler() { return; } virtual ~ftfiler() { return; }
virtual bool RequestCacheFile(std::string id, std::string path, virtual bool RequestCacheFile(std::string id, std::string path,
std::string hash, uint32_t size); std::string hash, uint64_t size);
virtual int getFile(std::string name, std::string hash, virtual int getFile(std::string name, std::string hash,
uint32_t size, std::string destpath); uint64_t size, std::string destpath);
virtual int cancelFile(std::string hash); virtual int cancelFile(std::string hash);
virtual int clearFailedTransfers(); virtual int clearFailedTransfers();
int tick(); int tick();
std::list<FileTransferItem *> getStatus(); std::list<RsFileTransfer *> getStatus();
virtual void setSaveBasePath(std::string s); virtual void setSaveBasePath(std::string s);
@ -179,13 +179,13 @@ private:
virtual int handleFileError(std::string hash, uint32_t err); virtual int handleFileError(std::string hash, uint32_t err);
virtual int handleFileNotOnline(std::string hash); virtual int handleFileNotOnline(std::string hash);
virtual int handleFileNotAvailable(std::string hash); virtual int handleFileNotAvailable(std::string hash);
virtual int handleFileData(std::string hash, uint32_t offset, virtual int handleFileData(std::string hash, uint64_t offset,
void *data, uint32_t size); void *data, uint32_t size);
virtual int handleFileRequest( std::string id, std::string hash, virtual int handleFileRequest( std::string id, std::string hash,
uint32_t offset, uint32_t chunk); uint64_t offset, uint32_t chunk);
virtual int handleFileCacheRequest(std::string id, std::string hash, virtual int handleFileCacheRequest(std::string id, std::string hash,
uint32_t offset, uint32_t chunk); uint64_t offset, uint32_t chunk);
ftFileStatus *findRecvFileItem(std::string hash); ftFileStatus *findRecvFileItem(std::string hash);
void queryInactive(); void queryInactive();
@ -199,7 +199,7 @@ int requestData(ftFileStatus *item);
ftFileStatus * createFileCache(std::string hash); ftFileStatus * createFileCache(std::string hash);
ftFileRequest * generateFileRequest(ftFileStatus *); ftFileRequest * generateFileRequest(ftFileStatus *);
int generateFileData(ftFileStatus *s, std::string id, uint32_t offset, uint32_t size); int generateFileData(ftFileStatus *s, std::string id, uint64_t offset, uint32_t size);
//int sendFileNotAvail(PQFileItem *req); //int sendFileNotAvail(PQFileItem *req);
/************* FILE DATA HANDLING ****************************** /************* FILE DATA HANDLING ******************************
@ -210,7 +210,7 @@ std::string determineDestFilePath(ftFileStatus *s);
int initiateFileTransfer(ftFileStatus *s); int initiateFileTransfer(ftFileStatus *s);
int resetFileTransfer(ftFileStatus *s); int resetFileTransfer(ftFileStatus *s);
int addFileData(ftFileStatus *s, long idx, void *data, int size); int addFileData(ftFileStatus *s, uint64_t idx, void *data, uint32_t size);
int completeFileTransfer(ftFileStatus *s); int completeFileTransfer(ftFileStatus *s);

View File

@ -32,7 +32,7 @@
#include "dbase/fimonitor.h" #include "dbase/fimonitor.h"
/* Search Interface - For FileTransfer Lookup */ /* Search Interface - For FileTransfer Lookup */
int FileHashSearch::searchLocalHash(std::string hash, std::string &path, uint32_t &size) int FileHashSearch::searchLocalHash(std::string hash, std::string &path, uint64_t &size)
{ {
if (monitor) if (monitor)
{ {

View File

@ -48,7 +48,7 @@ class FileHashSearch
~FileHashSearch() { return; } ~FileHashSearch() { return; }
/* Search Interface - For FileTransfer Lookup */ /* Search Interface - For FileTransfer Lookup */
int searchLocalHash(std::string hash, std::string &path, uint32_t &size); int searchLocalHash(std::string hash, std::string &path, uint64_t &size);
int searchRemoteHash(std::string hash, std::list<FileDetail> &results); int searchRemoteHash(std::string hash, std::list<FileDetail> &results);