mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-28 00:49:28 -05:00
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:
parent
2c9c31eaf0
commit
d9efb76b01
@ -2,8 +2,8 @@
|
||||
RS_TOP_DIR = ..
|
||||
include ../make.opt
|
||||
|
||||
OBJ = filedexserver.o pqifiler.o \
|
||||
ft.o ftfiler.o hashsearch.o
|
||||
OBJ = ft.o ftfiler.o hashsearch.o \
|
||||
filedexserver.o
|
||||
|
||||
EXEC = ftcachetest
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -49,6 +49,7 @@
|
||||
|
||||
#include "pqi/pqi.h"
|
||||
#include "pqi/pqiindic.h"
|
||||
#include "serialiser/rsconfigitems.h"
|
||||
#include <map>
|
||||
#include <deque>
|
||||
#include <list>
|
||||
@ -82,23 +83,25 @@ class filedexserver
|
||||
void loadWelcomeMsg(); /* startup message */
|
||||
|
||||
int setSearchInterface(P3Interface *si, sslroot *sr);
|
||||
int additem(SearchItem *item, char *fname);
|
||||
//int additem(SearchItem *item, char *fname);
|
||||
|
||||
int sendChat(std::string msg);
|
||||
int sendPrivateChat(ChatItem *ci);
|
||||
//int sendChat(std::string msg);
|
||||
//int sendPrivateChat(ChatItem *ci);
|
||||
|
||||
int sendRecommend(PQFileItem *fi, std::string msg);
|
||||
int sendMessage(MsgItem *item);
|
||||
int checkOutgoingMessages();
|
||||
//int sendRecommend(PQFileItem *fi, std::string msg);
|
||||
//int sendMessage(MsgItem *item);
|
||||
//int checkOutgoingMessages();
|
||||
|
||||
int getChat();
|
||||
//int getChat();
|
||||
/* std::deque<std::string> &getChatQueue(); */
|
||||
std::list<ChatItem *> getChatQueue();
|
||||
//std::list<ChatItem *> getChatQueue();
|
||||
|
||||
std::list<MsgItem *> &getMsgList();
|
||||
std::list<MsgItem *> &getMsgOutList();
|
||||
std::list<MsgItem *> getNewMsgs();
|
||||
std::list<FileTransferItem *> getTransfers();
|
||||
//std::list<MsgItem *> &getMsgList();
|
||||
//std::list<MsgItem *> &getMsgOutList();
|
||||
//std::list<MsgItem *> getNewMsgs();
|
||||
|
||||
|
||||
std::list<RsFileTransfer *> getTransfers();
|
||||
|
||||
// get files (obsolete?)
|
||||
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);
|
||||
|
||||
// cleaning up....
|
||||
int removeMsgItem(int itemnum);
|
||||
//int removeMsgItem(int itemnum);
|
||||
// alternative versions.
|
||||
int removeMsgItem(MsgItem *mi);
|
||||
//int removeMsgItem(MsgItem *mi);
|
||||
// third versions.
|
||||
int removeMsgId(unsigned long mid); /* id stored in sid */
|
||||
int markMsgIdRead(unsigned long mid);
|
||||
//int removeMsgId(unsigned long mid); /* id stored in sid */
|
||||
//int markMsgIdRead(unsigned long mid);
|
||||
|
||||
// access to search info is also required.
|
||||
|
||||
@ -134,20 +137,17 @@ void setSaveIncSearch(bool v);
|
||||
int tick();
|
||||
int status();
|
||||
|
||||
|
||||
private:
|
||||
|
||||
int handleInputQueues();
|
||||
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;
|
||||
|
||||
P3Interface *pqisi;
|
||||
sslroot *sslr;
|
||||
sslroot *sslr;
|
||||
|
||||
P3Interface *pqisi;
|
||||
|
||||
std::string config_dir;
|
||||
std::string save_dir;
|
||||
@ -155,23 +155,23 @@ bool save_inc; // is savedir include in share list.
|
||||
|
||||
// bool state flags.
|
||||
public:
|
||||
Indicator msgChanged;
|
||||
Indicator msgMajorChanged;
|
||||
Indicator chatChanged;
|
||||
// Indicator msgChanged;
|
||||
// Indicator msgMajorChanged;
|
||||
// Indicator chatChanged;
|
||||
|
||||
#ifdef PQI_USE_CHANNELS
|
||||
|
||||
public:
|
||||
// Channel stuff.
|
||||
void setP3Channel(p3channel *p3c);
|
||||
int getAvailableChannels(std::list<pqichannel *> &chans);
|
||||
int getChannelMsgList(channelSign s, std::list<chanMsgSummary> &summary);
|
||||
channelMsg *getChannelMsg(channelSign s, MsgHash mh);
|
||||
//void setP3Channel(p3channel *p3c);
|
||||
//int getAvailableChannels(std::list<pqichannel *> &chans);
|
||||
//int getChannelMsgList(channelSign s, std::list<chanMsgSummary> &summary);
|
||||
//channelMsg *getChannelMsg(channelSign s, MsgHash mh);
|
||||
|
||||
Indicator channelsChanged; // everything!
|
||||
// Indicator channelsChanged; // everything!
|
||||
|
||||
private:
|
||||
p3channel *p3chan;
|
||||
//p3channel *p3chan;
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -26,7 +26,7 @@
|
||||
|
||||
#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;
|
||||
|
||||
|
@ -29,13 +29,14 @@
|
||||
/*
|
||||
* ftManager - virtual base class for FileTransfer
|
||||
*/
|
||||
|
||||
|
||||
#include "pqi/pqi.h"
|
||||
#include <list>
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
#include "pqi/pqi.h"
|
||||
#include "serialiser/rsconfigitems.h"
|
||||
|
||||
#include "dbase/cachestrapper.h"
|
||||
#include "server/hashsearch.h"
|
||||
|
||||
@ -46,7 +47,7 @@ class ftFileRequest
|
||||
{
|
||||
public:
|
||||
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)
|
||||
:id(id_in), hash(hash_in), size(size_in),
|
||||
offset(offset_in), chunk(chunk_in)
|
||||
@ -58,8 +59,8 @@ virtual ~ftFileRequest() { return; }
|
||||
|
||||
std::string id;
|
||||
std::string hash;
|
||||
uint32_t size;
|
||||
uint32_t offset;
|
||||
uint64_t size;
|
||||
uint64_t offset;
|
||||
uint32_t chunk;
|
||||
};
|
||||
|
||||
@ -68,7 +69,7 @@ class ftFileData: public ftFileRequest
|
||||
{
|
||||
public:
|
||||
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)
|
||||
:ftFileRequest(id_in, hash_in, size_in,
|
||||
offset_in, chunk_in), data(data_in)
|
||||
@ -103,16 +104,16 @@ void setFileHashSearch(FileHashSearch *hs) { fhs = hs; }
|
||||
/*********** overloaded from CacheTransfer ***************/
|
||||
/* Must callback after this fn - using utility functions */
|
||||
//virtual bool RequestCacheFile(RsPeerId id, std::string path,
|
||||
// std::string hash, uint32_t size);
|
||||
// std::string hash, uint64_t size);
|
||||
/******************* GUI Interface ************************/
|
||||
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 clearFailedTransfers() = 0;
|
||||
|
||||
virtual int tick() = 0;
|
||||
virtual std::list<FileTransferItem *> getStatus() = 0;
|
||||
virtual std::list<RsFileTransfer *> getStatus() = 0;
|
||||
|
||||
/************* Network Interface****************************/
|
||||
|
||||
@ -126,7 +127,7 @@ virtual ftFileRequest * sendFileInfo() = 0;
|
||||
/****************** UTILITY 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);
|
||||
|
||||
/*********** callback from CacheTransfer ***************/
|
||||
@ -142,3 +143,12 @@ bool lookupRemoteHash(std::string hash, std::list<std::string> &ids);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -61,19 +61,19 @@ const int ftfilerzone = 86539;
|
||||
*
|
||||
*/
|
||||
|
||||
const int PQIFILE_OFFLINE_CHECK = 120; /* check every 2 minutes */
|
||||
const int PQIFILE_DOWNLOAD_TIMEOUT = 60; /* time it out, -> offline after 60 secs */
|
||||
const int PQIFILE_DOWNLOAD_CHECK = 10; /* desired delta = 10 secs */
|
||||
const int PQIFILE_DOWNLOAD_TOO_FAST = 8; /* 8 secs */
|
||||
const int PQIFILE_DOWNLOAD_TOO_SLOW = 12; /* 12 secs */
|
||||
const int PQIFILE_DOWNLOAD_MIN_DELTA = 5; /* 5 secs */
|
||||
const uint32_t PQIFILE_OFFLINE_CHECK = 120; /* check every 2 minutes */
|
||||
const uint32_t PQIFILE_DOWNLOAD_TIMEOUT = 60; /* time it out, -> offline after 60 secs */
|
||||
const uint32_t PQIFILE_DOWNLOAD_CHECK = 10; /* desired delta = 10 secs */
|
||||
const uint32_t PQIFILE_DOWNLOAD_TOO_FAST = 8; /* 8 secs */
|
||||
const uint32_t PQIFILE_DOWNLOAD_TOO_SLOW = 12; /* 12 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_NORMAL_RATE = 500000; /* 500 kbyte limit - everyone uses this one for now */
|
||||
const float TRANSFER_MODE_FAST_RATE = 500000; /* 500 kbyte limit */
|
||||
|
||||
const int TRANSFER_START_MIN = 500; /* 500 byte min limit */
|
||||
const int TRANSFER_START_MAX = 10000; /* 10000 byte max limit */
|
||||
const uint32_t TRANSFER_START_MIN = 500; /* 500 byte min limit */
|
||||
const uint32_t TRANSFER_START_MAX = 10000; /* 10000 byte max limit */
|
||||
|
||||
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,
|
||||
uint32_t size, std::string destpath)
|
||||
uint64_t size, std::string destpath)
|
||||
{
|
||||
/* add to local queue */
|
||||
{
|
||||
@ -141,7 +141,7 @@ int ftfiler::getFile(std::string name, std::string hash,
|
||||
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 */
|
||||
{
|
||||
@ -307,72 +307,147 @@ int ftfiler::clearFailedTransfers()
|
||||
return 1;
|
||||
}
|
||||
|
||||
std::list<FileTransferItem *> ftfiler::getStatus()
|
||||
std::list<RsFileTransfer *> ftfiler::getStatus()
|
||||
{
|
||||
pqioutput(PQL_DEBUG_BASIC, ftfilerzone,
|
||||
"ftfiler::getTransferStatus()");
|
||||
std::list<FileTransferItem *> stateList;
|
||||
std::list<RsFileTransfer *> stateList;
|
||||
|
||||
/* iterate through all files to recv */
|
||||
std::list<ftFileStatus *>::iterator it;
|
||||
for(it = recvFiles.begin(); it != recvFiles.end(); it++)
|
||||
{
|
||||
FileTransferItem *fti = new FileTransferItem();
|
||||
RsFileTransfer *rft = new RsFileTransfer();
|
||||
rft -> in = true;
|
||||
|
||||
/* fill in the basics
|
||||
* HACK - note - current system cannot save without a cert!
|
||||
* - so use ours!
|
||||
*/
|
||||
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)
|
||||
/* Ids: current and all */
|
||||
std::list<std::string>::iterator pit;
|
||||
for(pit = (*it)->sources.begin();
|
||||
pit != (*it)->sources.end(); pit++)
|
||||
{
|
||||
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 */
|
||||
fti -> transferred = (*it)->recv_size;
|
||||
fti -> crate = (*it)->rate / 1000.0; // kbytes.
|
||||
fti -> trate = (*it)->rate / 1000.0; // kbytes.
|
||||
fti -> lrate = (*it)->rate / 1000.0; // kbytes.
|
||||
fti -> ltransfer = (*it)->req_size;
|
||||
fti -> in = true;
|
||||
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)
|
||||
{
|
||||
fti -> crate = 0;
|
||||
fti -> trate = 0;
|
||||
fti -> lrate = 0;
|
||||
fti -> ltransfer = 0;
|
||||
fti -> state = FT_STATE_OKAY;
|
||||
rft -> crate = 0;
|
||||
rft -> trate = 0;
|
||||
rft -> lrate = 0;
|
||||
rft -> ltransfer = 0;
|
||||
rft -> state = FT_STATE_WAITING;
|
||||
}
|
||||
else if ((*it) -> status & PQIFILE_FAIL)
|
||||
{
|
||||
fti -> crate = 0;
|
||||
fti -> trate = 0;
|
||||
fti -> lrate = 0;
|
||||
fti -> ltransfer = 0;
|
||||
fti -> state = FT_STATE_FAILED;
|
||||
rft -> crate = 0;
|
||||
rft -> trate = 0;
|
||||
rft -> lrate = 0;
|
||||
rft -> ltransfer = 0;
|
||||
rft -> state = FT_STATE_FAILED;
|
||||
|
||||
}
|
||||
else if ((*it) -> status == PQIFILE_COMPLETE)
|
||||
{
|
||||
fti -> state = FT_STATE_COMPLETE;
|
||||
rft -> state = FT_STATE_COMPLETE;
|
||||
}
|
||||
else if ((*it) -> status == PQIFILE_DOWNLOADING)
|
||||
{
|
||||
fti -> state = FT_STATE_OKAY;
|
||||
rft -> state = FT_STATE_DOWNLOADING;
|
||||
}
|
||||
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;
|
||||
}
|
||||
@ -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)
|
||||
{
|
||||
pqioutput(PQL_DEBUG_BASIC, ftfilerzone,
|
||||
@ -512,7 +587,7 @@ int ftfiler::handleFileData(std::string hash, uint32_t offset,
|
||||
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,
|
||||
"ftfiler::handleFileRequest()");
|
||||
@ -539,7 +614,7 @@ int ftfiler::handleFileRequest(std::string id, std::string hash, uint32_t offset
|
||||
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,
|
||||
"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,
|
||||
"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,
|
||||
"ftfiler::addFileData()");
|
||||
@ -1265,7 +1340,7 @@ ftFileStatus *ftfiler::createFileCache(std::string hash)
|
||||
|
||||
/* so look it up! */
|
||||
std::string srcpath;
|
||||
uint32_t size;
|
||||
uint64_t size;
|
||||
if (lookupLocalHash(s->hash, srcpath, size))
|
||||
{
|
||||
found = true;
|
||||
|
@ -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)
|
||||
: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),
|
||||
@ -92,7 +92,7 @@ public:
|
||||
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)
|
||||
: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),
|
||||
@ -119,7 +119,7 @@ public:
|
||||
std::string name;
|
||||
std::string hash;
|
||||
std::string destpath;
|
||||
uint32_t size;
|
||||
uint64_t size;
|
||||
|
||||
/* new stuff */
|
||||
uint32_t ftMode;
|
||||
@ -133,18 +133,18 @@ public:
|
||||
|
||||
std::string file_name;
|
||||
FILE *fd;
|
||||
long total_size;
|
||||
uint64_t total_size;
|
||||
/* this is the simplistic case where only inorder data
|
||||
* otherwise - need much more status info */
|
||||
long recv_size;
|
||||
uint64_t recv_size;
|
||||
|
||||
/* current file data request */
|
||||
long req_loc;
|
||||
int req_size;
|
||||
uint64_t req_loc;
|
||||
uint32_t req_size;
|
||||
|
||||
/* timestamp */
|
||||
long lastTS;
|
||||
int lastDelta; /* send til all recved */
|
||||
time_t lastTS;
|
||||
uint32_t lastDelta; /* send til all recved */
|
||||
};
|
||||
|
||||
|
||||
@ -158,15 +158,15 @@ public:
|
||||
virtual ~ftfiler() { return; }
|
||||
|
||||
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,
|
||||
uint32_t size, std::string destpath);
|
||||
uint64_t size, std::string destpath);
|
||||
|
||||
virtual int cancelFile(std::string hash);
|
||||
virtual int clearFailedTransfers();
|
||||
|
||||
int tick();
|
||||
std::list<FileTransferItem *> getStatus();
|
||||
std::list<RsFileTransfer *> getStatus();
|
||||
|
||||
virtual void setSaveBasePath(std::string s);
|
||||
|
||||
@ -179,13 +179,13 @@ private:
|
||||
virtual int handleFileError(std::string hash, uint32_t err);
|
||||
virtual int handleFileNotOnline(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);
|
||||
|
||||
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,
|
||||
uint32_t offset, uint32_t chunk);
|
||||
uint64_t offset, uint32_t chunk);
|
||||
|
||||
ftFileStatus *findRecvFileItem(std::string hash);
|
||||
void queryInactive();
|
||||
@ -199,7 +199,7 @@ int requestData(ftFileStatus *item);
|
||||
|
||||
ftFileStatus * createFileCache(std::string hash);
|
||||
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);
|
||||
|
||||
/************* FILE DATA HANDLING ******************************
|
||||
@ -210,7 +210,7 @@ std::string determineDestFilePath(ftFileStatus *s);
|
||||
|
||||
int initiateFileTransfer(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);
|
||||
|
||||
|
||||
|
@ -32,7 +32,7 @@
|
||||
#include "dbase/fimonitor.h"
|
||||
|
||||
/* 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)
|
||||
{
|
||||
|
@ -48,7 +48,7 @@ class FileHashSearch
|
||||
~FileHashSearch() { return; }
|
||||
|
||||
/* 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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user