mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-06-28 16:17:28 -04:00
Finished off the basic Link Ranking system.
* added serialiser types. * finished streaming on p3ranking. * removed Bandwidth limitations from BinFile / BinMem. * added bytecount() to BinInterface. * moved the CacheTransfer creation to Startup. * added ranking to CacheStrapper & server tick() system. * Tweaked LinksDialog for final touches. * enabled downloads from Messages. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@335 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
925b1a780e
commit
2c69fd7eaf
19 changed files with 744 additions and 112 deletions
|
@ -29,7 +29,7 @@
|
|||
#include "pqi/pqibin.h"
|
||||
|
||||
BinFileInterface::BinFileInterface(const char *fname, int flags)
|
||||
:bin_flags(flags), buf(NULL), hash(NULL)
|
||||
:bin_flags(flags), buf(NULL), hash(NULL), bcount(0)
|
||||
{
|
||||
/* if read + write - open r+ */
|
||||
if ((bin_flags & BIN_FLAGS_READABLE) &&
|
||||
|
@ -102,6 +102,7 @@ int BinFileInterface::senddata(void *data, int len)
|
|||
if (bin_flags & BIN_FLAGS_HASH_DATA)
|
||||
{
|
||||
hash->addData(data, len);
|
||||
bcount += len;
|
||||
}
|
||||
return len;
|
||||
}
|
||||
|
@ -118,6 +119,7 @@ int BinFileInterface::readdata(void *data, int len)
|
|||
if (bin_flags & BIN_FLAGS_HASH_DATA)
|
||||
{
|
||||
hash->addData(data, len);
|
||||
bcount += len;
|
||||
}
|
||||
return len;
|
||||
}
|
||||
|
@ -131,11 +133,20 @@ std::string BinFileInterface::gethash()
|
|||
}
|
||||
return hashstr;
|
||||
}
|
||||
|
||||
uint64_t BinFileInterface::bytecount()
|
||||
{
|
||||
if (bin_flags & BIN_FLAGS_HASH_DATA)
|
||||
{
|
||||
return bcount;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
BinMemInterface::BinMemInterface(int defsize, int flags)
|
||||
:bin_flags(flags), buf(NULL), size(defsize),
|
||||
recvsize(0), readloc(0), hash(NULL)
|
||||
recvsize(0), readloc(0), hash(NULL), bcount(0)
|
||||
{
|
||||
buf = malloc(defsize);
|
||||
if (bin_flags & BIN_FLAGS_HASH_DATA)
|
||||
|
@ -174,6 +185,7 @@ int BinMemInterface::senddata(void *data, int len)
|
|||
if (bin_flags & BIN_FLAGS_HASH_DATA)
|
||||
{
|
||||
hash->addData(data, len);
|
||||
bcount += len;
|
||||
}
|
||||
recvsize += len;
|
||||
return len;
|
||||
|
@ -191,6 +203,7 @@ int BinMemInterface::readdata(void *data, int len)
|
|||
if (bin_flags & BIN_FLAGS_HASH_DATA)
|
||||
{
|
||||
hash->addData(data, len);
|
||||
bcount += len;
|
||||
}
|
||||
readloc += len;
|
||||
return len;
|
||||
|
@ -209,6 +222,16 @@ std::string BinMemInterface::gethash()
|
|||
}
|
||||
|
||||
|
||||
uint64_t BinMemInterface::bytecount()
|
||||
{
|
||||
if (bin_flags & BIN_FLAGS_HASH_DATA)
|
||||
{
|
||||
return bcount;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
|
||||
|
@ -426,5 +449,3 @@ std::string NetBinDummy::gethash()
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue