Merge pull request #1098 from csoler/v0.6-PRTest

V0.6 pr test
This commit is contained in:
csoler 2017-11-05 16:36:49 +01:00 committed by GitHub
commit 5dbefc529d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 30 additions and 26 deletions

View File

@ -887,7 +887,10 @@ void InternalFileHierarchyStorage::print() const
std::cerr << "(EE) Error: unknown type node found!" << std::endl;
}
std::cerr << "Total nodes: " << mNodes.size() << " (" << nfiles << " files, " << ndirs << " dirs, " << nempty << " empty slots)" << std::endl;
std::cerr << "Total nodes: " << mNodes.size() << " (" << nfiles << " files, " << ndirs << " dirs, " << nempty << " empty slots";
if (nunknown > 0) std::cerr << ", " << nunknown << " unknown";
std::cerr << ")" << std::endl;
recursPrint(0,DirectoryStorage::EntryIndex(0));

View File

@ -68,7 +68,7 @@ public:
class DirEntry: public FileStorageNode
{
public:
DirEntry(const std::string& name) : dir_name(name), dir_modtime(0),dir_most_recent_time(0),dir_update_time(0) {}
explicit DirEntry(const std::string& name) : dir_name(name), dir_modtime(0),dir_most_recent_time(0),dir_update_time(0) {}
virtual ~DirEntry() {}
virtual uint32_t type() const { return FileStorageNode::TYPE_DIR ; }

View File

@ -576,7 +576,7 @@ bool LocalDirectoryStorage::getFileInfo(DirectoryStorage::EntryIndex i,FileInfo&
info.transfered = 0;
info.tfRate = 0; /* in kbytes */
info.downloadStatus = FT_STATE_COMPLETE ;
std::list<TransferInfo> peers;
//std::list<TransferInfo> peers;
info.priority = SPEED_NORMAL;
info.lastTS = 0;

View File

@ -97,7 +97,7 @@ class DirectoryStorage
class FileIterator
{
public:
FileIterator(DirIterator& d); // crawls all files in specified directory
explicit FileIterator(DirIterator& d); // crawls all files in specified directory
FileIterator(DirectoryStorage *d,EntryIndex e); // crawls all files in specified directory
FileIterator& operator++() ;

View File

@ -54,7 +54,7 @@ public:
class HashStorage: public RsTickingThread
{
public:
HashStorage(const std::string& save_file_name) ;
explicit HashStorage(const std::string& save_file_name) ;
/*!
* \brief requestHash Requests the hash for the given file, assuming size and mod_time are the same.

View File

@ -437,14 +437,14 @@ bool p3FileDatabase::loadList(std::list<RsItem *>& load)
if (NULL != (rskv = dynamic_cast<RsConfigKeyValueSet *>(*it)))
{
/* make into map */
std::map<std::string, std::string> configMap;
std::map<std::string, std::string>::const_iterator mit ;
//std::map<std::string, std::string> configMap;
//std::map<std::string, std::string>::const_iterator mit ;
for(std::list<RsTlvKeyValue>::const_iterator kit = rskv->tlvkvs.pairs.begin(); kit != rskv->tlvkvs.pairs.end(); ++kit)
if (kit->key == HASH_CACHE_DURATION_SS)
{
uint32_t t=0 ;
if(sscanf(kit->value.c_str(),"%d",&t) == 1)
if(sscanf(kit->value.c_str(),"%u",&t) == 1)
mHashCache->setRememberHashFilesDuration(t);
}
else if(kit->key == WATCH_FILE_DURATION_SS)
@ -1744,7 +1744,7 @@ void p3FileDatabase::locked_recursSweepRemoteDirectory(RemoteDirectoryStorage *r
{
time_t now = time(NULL) ;
std::string indent(2*depth,' ') ;
//std::string indent(2*depth,' ') ;
// if not up to date, request update, and return (content is not certified, so no need to recurs yet).
// if up to date, return, because TS is about the last modif TS below, so no need to recurs either.

View File

@ -83,7 +83,7 @@ class p3FileDatabase: public p3Service, public p3Config, public ftSearch //, pub
// [...] more to add here
};
p3FileDatabase(p3ServiceControl *mpeers) ;
explicit p3FileDatabase(p3ServiceControl *mpeers) ;
~p3FileDatabase();
/*!

View File

@ -49,7 +49,7 @@ const uint8_t RS_PKT_SUBTYPE_FILELISTS_CONFIG_ITEM = 0x03;
class RsFileListsItem : public RsItem
{
public:
RsFileListsItem(uint8_t subtype)
explicit RsFileListsItem(uint8_t subtype)
: RsItem(RS_PKT_VERSION_SERVICE, RS_SERVICE_TYPE_FILE_DATABASE, subtype)
{
setPriorityLevel(QOS_PRIORITY_RS_SLOW_SYNC_REQUEST); // this is the default. Someitems may be faster, on demand.
@ -75,7 +75,7 @@ class RsFileListsSyncRequestItem : public RsFileListsItem
{
public:
RsFileListsSyncRequestItem() : RsFileListsItem(RS_PKT_SUBTYPE_FILELISTS_SYNC_REQ_ITEM) {}
RsFileListsSyncRequestItem() : RsFileListsItem(RS_PKT_SUBTYPE_FILELISTS_SYNC_REQ_ITEM), flags(0), last_known_recurs_modf_TS(0), request_id(0) {}
virtual void clear(){}
@ -91,7 +91,7 @@ class RsFileListsSyncResponseItem : public RsFileListsItem
{
public:
RsFileListsSyncResponseItem() : RsFileListsItem(RS_PKT_SUBTYPE_FILELISTS_SYNC_RSP_ITEM) {}
RsFileListsSyncResponseItem() : RsFileListsItem(RS_PKT_SUBTYPE_FILELISTS_SYNC_RSP_ITEM), flags(0), last_known_recurs_modf_TS(0), request_id(0) {}
virtual void clear();

View File

@ -34,7 +34,7 @@ class ftChunk
public:
typedef uint64_t ChunkId ;
ftChunk():offset(0), size(0), ts(0),ref_cnt(NULL) {}
ftChunk():offset(0), size(0), id(0), ts(0),ref_cnt(NULL) {}
friend std::ostream& operator<<(std::ostream& o,const ftChunk& f) ;

View File

@ -83,7 +83,7 @@ bool ftFileCreator::getFileData(const RsPeerId& peer_id,uint64_t offset, uint32_
// try if we have data from an incomplete or not veryfied chunk
if(!have_it && allow_unverified)
{
std::map<uint64_t, ftChunk>::iterator it;
//std::map<uint64_t, ftChunk>::iterator it;
have_it = true;
// this map contains chunks which are currently being downloaded
for(std::map<uint64_t,ftChunk>::iterator it=mChunks.begin(); it!=mChunks.end(); ++it)
@ -542,6 +542,7 @@ bool ftFileCreator::getMissingChunk(const RsPeerId& peer_id,uint32_t size_hint,u
mChunks[chunk.offset] = chunk ;
offset = chunk.offset ;
// cppcheck-suppress unreadVariable
size = chunk.size ;
++chunks_for_this_peer ; // increase number of chunks for this peer.

View File

@ -131,8 +131,8 @@ void ftServer::SetupFtServer()
{
/* setup FiStore/Monitor */
std::string localcachedir = mConfigPath + "/cache/local";
std::string remotecachedir = mConfigPath + "/cache/remote";
//std::string localcachedir = mConfigPath + "/cache/local";
//std::string remotecachedir = mConfigPath + "/cache/remote";
RsPeerId ownId = mServiceCtrl->getOwnId();
/* search/extras List */

View File

@ -155,7 +155,7 @@ bool ftTransferModule::addFileSource(const RsPeerId& peerId)
/* add in new source */
peerInfo pInfo(peerId);
mFileSources.insert(std::pair<RsPeerId,peerInfo>(peerId,pInfo));
mit = mFileSources.find(peerId);
//mit = mFileSources.find(peerId);
mMultiplexor->sendChunkMapRequest(peerId, mHash,false) ;
#ifdef FT_DEBUG
@ -545,7 +545,7 @@ bool ftTransferModule::isCheckingHash()
class HashThread: public RsSingleJobThread
{
public:
HashThread(ftFileCreator *m)
explicit HashThread(ftFileCreator *m)
: _hashThreadMtx("HashThread"), _m(m),_finished(false),_hash("") {}
virtual void run()

View File

@ -56,7 +56,7 @@ class HashThread ;
class peerInfo
{
public:
peerInfo(const RsPeerId& peerId_in):peerId(peerId_in),state(PQIPEER_NOT_ONLINE),desiredRate(0),actualRate(0),
explicit peerInfo(const RsPeerId& peerId_in):peerId(peerId_in),state(PQIPEER_NOT_ONLINE),desiredRate(0),actualRate(0),
lastTS(0),
recvTS(0), lastTransfers(0), nResets(0),
rtt(0), rttActive(false), rttStart(0), rttOffset(0),
@ -111,7 +111,7 @@ public:
};
ftFileStatus():hash(""),stat(PQIFILE_INIT) {}
ftFileStatus(const RsFileHash& hash_in):hash(hash_in),stat(PQIFILE_INIT) {}
explicit ftFileStatus(const RsFileHash& hash_in):hash(hash_in),stat(PQIFILE_INIT) {}
RsFileHash hash;
Status stat;

View File

@ -33,7 +33,7 @@
class RsTurtleFileRequestItem: public RsTurtleGenericTunnelItem
{
public:
RsTurtleFileRequestItem() : RsTurtleGenericTunnelItem(RS_TURTLE_SUBTYPE_FILE_REQUEST) { setPriorityLevel(QOS_PRIORITY_RS_TURTLE_FILE_REQUEST);}
RsTurtleFileRequestItem() : RsTurtleGenericTunnelItem(RS_TURTLE_SUBTYPE_FILE_REQUEST), chunk_offset(0), chunk_size(0) { setPriorityLevel(QOS_PRIORITY_RS_TURTLE_FILE_REQUEST);}
virtual bool shouldStampTunnel() const { return false ; }
virtual Direction travelingDirection() const { return DIRECTION_SERVER ; }
@ -49,7 +49,7 @@ class RsTurtleFileRequestItem: public RsTurtleGenericTunnelItem
class RsTurtleFileDataItem: public RsTurtleGenericTunnelItem
{
public:
RsTurtleFileDataItem() : RsTurtleGenericTunnelItem(RS_TURTLE_SUBTYPE_FILE_DATA) { setPriorityLevel(QOS_PRIORITY_RS_TURTLE_FILE_DATA) ;}
RsTurtleFileDataItem() : RsTurtleGenericTunnelItem(RS_TURTLE_SUBTYPE_FILE_DATA), chunk_offset(0), chunk_size(0), chunk_data(NULL) { setPriorityLevel(QOS_PRIORITY_RS_TURTLE_FILE_DATA) ;}
~RsTurtleFileDataItem() { clear() ; }
virtual bool shouldStampTunnel() const { return true ; }
@ -99,13 +99,13 @@ class RsTurtleFileMapItem: public RsTurtleGenericTunnelItem
class RsTurtleChunkCrcRequestItem: public RsTurtleGenericTunnelItem
{
public:
RsTurtleChunkCrcRequestItem() : RsTurtleGenericTunnelItem(RS_TURTLE_SUBTYPE_CHUNK_CRC_REQUEST) { setPriorityLevel(QOS_PRIORITY_RS_CHUNK_CRC_REQUEST);}
RsTurtleChunkCrcRequestItem() : RsTurtleGenericTunnelItem(RS_TURTLE_SUBTYPE_CHUNK_CRC_REQUEST), chunk_number(0) { setPriorityLevel(QOS_PRIORITY_RS_CHUNK_CRC_REQUEST);}
virtual bool shouldStampTunnel() const { return false ; }
virtual Direction travelingDirection() const { return DIRECTION_SERVER ; }
uint32_t chunk_number ; // id of the chunk to CRC.
void clear() {}
void serial_process(RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx);
};
@ -113,7 +113,7 @@ class RsTurtleChunkCrcRequestItem: public RsTurtleGenericTunnelItem
class RsTurtleChunkCrcItem: public RsTurtleGenericTunnelItem
{
public:
RsTurtleChunkCrcItem() : RsTurtleGenericTunnelItem(RS_TURTLE_SUBTYPE_CHUNK_CRC) { setPriorityLevel(QOS_PRIORITY_RS_CHUNK_CRC);}
RsTurtleChunkCrcItem() : RsTurtleGenericTunnelItem(RS_TURTLE_SUBTYPE_CHUNK_CRC), chunk_number(0) { setPriorityLevel(QOS_PRIORITY_RS_CHUNK_CRC);}
virtual bool shouldStampTunnel() const { return true ; }
virtual Direction travelingDirection() const { return DIRECTION_CLIENT ; }