mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-12-16 09:03:51 -05:00
Modified (all I hope) remaining pqistream -> pqistore for cache file save/loads.
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@1223 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
99828dfa41
commit
02fc02d23c
9 changed files with 53 additions and 84 deletions
|
|
@ -29,7 +29,6 @@
|
|||
#include "pqi/p3authmgr.h"
|
||||
#include "pqi/pqibin.h"
|
||||
#include "pqi/pqistore.h"
|
||||
#include "pqi/pqistreamer.h"
|
||||
#include "pqi/pqinotify.h"
|
||||
#include <errno.h>
|
||||
|
||||
|
|
@ -153,11 +152,9 @@ void p3ConfigMgr::saveConfiguration()
|
|||
BinMemInterface *membio = new BinMemInterface(1000, bioflags);
|
||||
RsSerialiser *rss = new RsSerialiser();
|
||||
rss->addSerialType(new RsGeneralConfigSerialiser());
|
||||
pqistreamer stream(rss, "CONFIG", membio, 0);
|
||||
pqistore store(rss, "CONFIG", membio, 0);
|
||||
|
||||
stream.SendItem(item);
|
||||
stream.tick();
|
||||
stream.tick();
|
||||
store.SendItem(item);
|
||||
|
||||
/* sign data */
|
||||
std::string signature;
|
||||
|
|
@ -296,10 +293,8 @@ void p3ConfigMgr::loadConfiguration()
|
|||
membio->fseek(0); /* go to start */
|
||||
RsSerialiser *rss = new RsSerialiser();
|
||||
rss->addSerialType(new RsGeneralConfigSerialiser());
|
||||
pqistreamer stream(rss, "CONFIG", membio, 0);
|
||||
pqistore stream(rss, "CONFIG", membio, 0);
|
||||
|
||||
stream.tick();
|
||||
stream.tick();
|
||||
RsItem *rsitem = stream.GetItem();
|
||||
|
||||
RsConfigKeyValueSet *item = dynamic_cast<RsConfigKeyValueSet *>(rsitem);
|
||||
|
|
@ -402,7 +397,7 @@ bool p3Config::loadConfiguration(std::string &loadHash)
|
|||
uint32_t stream_flags = BIN_FLAGS_READABLE;
|
||||
|
||||
BinInterface *bio = new BinFileInterface(fname.c_str(), bioflags);
|
||||
pqistore stream(setupSerialiser(), bio, stream_flags);
|
||||
pqistore stream(setupSerialiser(), "CONFIG", bio, stream_flags);
|
||||
RsItem *item = NULL;
|
||||
|
||||
while(NULL != (item = stream.GetItem()))
|
||||
|
|
@ -473,7 +468,7 @@ bool p3Config::saveConfiguration()
|
|||
stream_flags |= BIN_FLAGS_NO_DELETE;
|
||||
|
||||
BinInterface *bio = new BinFileInterface(fnametmp.c_str(), bioflags);
|
||||
pqistore *stream = new pqistore(setupSerialiser(), bio, stream_flags);
|
||||
pqistore *stream = new pqistore(setupSerialiser(), "CONFIG", bio, stream_flags);
|
||||
|
||||
std::list<RsItem *>::iterator it;
|
||||
|
||||
|
|
|
|||
|
|
@ -50,9 +50,9 @@
|
|||
|
||||
const int pqistorezone = 9511;
|
||||
|
||||
pqistore::pqistore(RsSerialiser *rss, BinInterface *bio_in, int bio_flags_in)
|
||||
pqistore::pqistore(RsSerialiser *rss, std::string srcId, BinInterface *bio_in, int bio_flags_in)
|
||||
:PQInterface(""), rsSerialiser(rss), bio(bio_in), bio_flags(bio_flags_in),
|
||||
nextPkt(NULL)
|
||||
nextPkt(NULL), mSrcId(srcId)
|
||||
{
|
||||
{
|
||||
std::ostringstream out;
|
||||
|
|
@ -363,6 +363,7 @@ int pqistore::readPkt(RsItem **item_out)
|
|||
return 0;
|
||||
}
|
||||
|
||||
item->PeerId(mSrcId);
|
||||
*item_out = item;
|
||||
return 1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@
|
|||
class pqistore: public PQInterface
|
||||
{
|
||||
public:
|
||||
pqistore(RsSerialiser *rss, BinInterface *bio_in, int bio_flagsin);
|
||||
pqistore(RsSerialiser *rss, std::string srcId, BinInterface *bio_in, int bio_flagsin);
|
||||
virtual ~pqistore();
|
||||
|
||||
// PQInterface
|
||||
|
|
@ -65,6 +65,7 @@ int readPkt(RsItem **item_out);
|
|||
|
||||
// Temp Storage for transient data.....
|
||||
RsItem *nextPkt;
|
||||
std::string mSrcId;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue