mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-06-06 21:58:57 -04:00
Added flag to disable dbase reset, and disable dummy data creation.
This also switches to alternative test data path - to ensure it will be empty. Fixed bug in p3idservice related to dummy id creation. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@6114 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
7867063734
commit
81307de7c9
8 changed files with 79 additions and 16 deletions
|
@ -7,7 +7,7 @@ CONFIG += test_voip
|
||||||
|
|
||||||
# GXS Stuff.
|
# GXS Stuff.
|
||||||
# This should be disabled for releases until further notice.
|
# This should be disabled for releases until further notice.
|
||||||
#CONFIG += gxs
|
CONFIG += gxs
|
||||||
|
|
||||||
# Beware: All data of the stripped services are lost
|
# Beware: All data of the stripped services are lost
|
||||||
DEFINES *= PQI_DISABLE_TUNNEL
|
DEFINES *= PQI_DISABLE_TUNNEL
|
||||||
|
@ -615,6 +615,9 @@ SOURCES += zeroconf/p3zcnatassist.cc \
|
||||||
gxs {
|
gxs {
|
||||||
DEFINES *= RS_ENABLE_GXS
|
DEFINES *= RS_ENABLE_GXS
|
||||||
|
|
||||||
|
#DEFINES *= GXS_DEV_TESTNET
|
||||||
|
#DEFINES *= GXS_ENABLE_SYNC_MSGS
|
||||||
|
|
||||||
HEADERS += serialiser/rsnxsitems.h \
|
HEADERS += serialiser/rsnxsitems.h \
|
||||||
gxs/rsgds.h \
|
gxs/rsgds.h \
|
||||||
gxs/rsgxs.h \
|
gxs/rsgxs.h \
|
||||||
|
|
|
@ -2271,6 +2271,11 @@ int RsServer::StartupRetroShare()
|
||||||
// and deleted
|
// and deleted
|
||||||
std::string priorGxsDir = "./" + mLinkMgr->getOwnId() + "/";
|
std::string priorGxsDir = "./" + mLinkMgr->getOwnId() + "/";
|
||||||
std::string currGxsDir = RsInitConfig::configDir + "/GXS_phase1";
|
std::string currGxsDir = RsInitConfig::configDir + "/GXS_phase1";
|
||||||
|
|
||||||
|
#ifdef GXS_DEV_TESTNET // Different Directory for testing.
|
||||||
|
currGxsDir += "_TESTNET";
|
||||||
|
#endif
|
||||||
|
|
||||||
bool cleanUpGxsDir = false;
|
bool cleanUpGxsDir = false;
|
||||||
|
|
||||||
if(!priorGxsDir.empty())
|
if(!priorGxsDir.empty())
|
||||||
|
@ -2294,7 +2299,9 @@ int RsServer::StartupRetroShare()
|
||||||
RsGeneralDataService* gxsid_ds = new RsDataService(currGxsDir + "/", "gxsid_db",
|
RsGeneralDataService* gxsid_ds = new RsDataService(currGxsDir + "/", "gxsid_db",
|
||||||
RS_SERVICE_GXSV1_TYPE_GXSID, NULL);
|
RS_SERVICE_GXSV1_TYPE_GXSID, NULL);
|
||||||
|
|
||||||
|
#ifndef GXS_DEV_TESTNET // NO RESET, OR DUMMYDATA for TESTNET
|
||||||
gxsid_ds->resetDataStore();
|
gxsid_ds->resetDataStore();
|
||||||
|
#endif
|
||||||
|
|
||||||
// init gxs services
|
// init gxs services
|
||||||
mGxsIdService = new p3IdService(gxsid_ds, NULL);
|
mGxsIdService = new p3IdService(gxsid_ds, NULL);
|
||||||
|
@ -2309,7 +2316,9 @@ int RsServer::StartupRetroShare()
|
||||||
RsGeneralDataService* gxscircles_ds = new RsDataService(currGxsDir + "/", "gxscircles_db",
|
RsGeneralDataService* gxscircles_ds = new RsDataService(currGxsDir + "/", "gxscircles_db",
|
||||||
RS_SERVICE_GXSV1_TYPE_GXSCIRCLE, NULL);
|
RS_SERVICE_GXSV1_TYPE_GXSCIRCLE, NULL);
|
||||||
|
|
||||||
|
#ifndef GXS_DEV_TESTNET // NO RESET, OR DUMMYDATA for TESTNET
|
||||||
gxscircles_ds->resetDataStore();
|
gxscircles_ds->resetDataStore();
|
||||||
|
#endif
|
||||||
|
|
||||||
// init gxs services
|
// init gxs services
|
||||||
mGxsCircles = new p3GxsCircles(gxscircles_ds, NULL, mGxsIdService);
|
mGxsCircles = new p3GxsCircles(gxscircles_ds, NULL, mGxsIdService);
|
||||||
|
@ -2342,7 +2351,9 @@ int RsServer::StartupRetroShare()
|
||||||
RsGeneralDataService* photo_ds = new RsDataService(currGxsDir + "/", "photoV2_db",
|
RsGeneralDataService* photo_ds = new RsDataService(currGxsDir + "/", "photoV2_db",
|
||||||
RS_SERVICE_GXSV1_TYPE_PHOTO, NULL);
|
RS_SERVICE_GXSV1_TYPE_PHOTO, NULL);
|
||||||
|
|
||||||
|
#ifndef GXS_DEV_TESTNET // NO RESET, OR DUMMYDATA for TESTNET
|
||||||
photo_ds->resetDataStore(); //TODO: remove, new service data per RS session, for testing
|
photo_ds->resetDataStore(); //TODO: remove, new service data per RS session, for testing
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
// init gxs services
|
// init gxs services
|
||||||
|
@ -2359,7 +2370,9 @@ int RsServer::StartupRetroShare()
|
||||||
RsGeneralDataService* posted_ds = new RsDataService(currGxsDir + "/", "posted_db",
|
RsGeneralDataService* posted_ds = new RsDataService(currGxsDir + "/", "posted_db",
|
||||||
RS_SERVICE_GXSV1_TYPE_POSTED);
|
RS_SERVICE_GXSV1_TYPE_POSTED);
|
||||||
|
|
||||||
|
#ifndef GXS_DEV_TESTNET // NO RESET, OR DUMMYDATA for TESTNET
|
||||||
posted_ds->resetDataStore(); //TODO: remove, new service data per RS session, for testing
|
posted_ds->resetDataStore(); //TODO: remove, new service data per RS session, for testing
|
||||||
|
#endif
|
||||||
|
|
||||||
mPosted = new p3Posted(posted_ds, NULL);
|
mPosted = new p3Posted(posted_ds, NULL);
|
||||||
|
|
||||||
|
@ -2375,7 +2388,9 @@ int RsServer::StartupRetroShare()
|
||||||
RsGeneralDataService* wiki_ds = new RsDataService(currGxsDir + "/", "wiki_db",
|
RsGeneralDataService* wiki_ds = new RsDataService(currGxsDir + "/", "wiki_db",
|
||||||
RS_SERVICE_GXSV1_TYPE_WIKI);
|
RS_SERVICE_GXSV1_TYPE_WIKI);
|
||||||
|
|
||||||
|
#ifndef GXS_DEV_TESTNET // NO RESET, OR DUMMYDATA for TESTNET
|
||||||
wiki_ds->resetDataStore(); //TODO: remove, new service data per RS session, for testing
|
wiki_ds->resetDataStore(); //TODO: remove, new service data per RS session, for testing
|
||||||
|
#endif
|
||||||
|
|
||||||
mWiki = new p3Wiki(wiki_ds, NULL);
|
mWiki = new p3Wiki(wiki_ds, NULL);
|
||||||
|
|
||||||
|
@ -2390,7 +2405,9 @@ int RsServer::StartupRetroShare()
|
||||||
RsGeneralDataService* wire_ds = new RsDataService(currGxsDir + "/", "wire_db",
|
RsGeneralDataService* wire_ds = new RsDataService(currGxsDir + "/", "wire_db",
|
||||||
RS_SERVICE_GXSV1_TYPE_WIRE);
|
RS_SERVICE_GXSV1_TYPE_WIRE);
|
||||||
|
|
||||||
|
#ifndef GXS_DEV_TESTNET // NO RESET, OR DUMMYDATA for TESTNET
|
||||||
wire_ds->resetDataStore(); //TODO: remove, new service data per RS session, for testing
|
wire_ds->resetDataStore(); //TODO: remove, new service data per RS session, for testing
|
||||||
|
#endif
|
||||||
|
|
||||||
mWire = new p3Wire(wire_ds, NULL);
|
mWire = new p3Wire(wire_ds, NULL);
|
||||||
|
|
||||||
|
@ -2404,7 +2421,9 @@ int RsServer::StartupRetroShare()
|
||||||
RsGeneralDataService* gxsforums_ds = new RsDataService(currGxsDir + "/", "gxsforums_db",
|
RsGeneralDataService* gxsforums_ds = new RsDataService(currGxsDir + "/", "gxsforums_db",
|
||||||
RS_SERVICE_GXSV1_TYPE_FORUMS);
|
RS_SERVICE_GXSV1_TYPE_FORUMS);
|
||||||
|
|
||||||
|
#ifndef GXS_DEV_TESTNET // NO RESET, OR DUMMYDATA for TESTNET
|
||||||
gxsforums_ds->resetDataStore(); //TODO: remove, new service data per RS session, for testing
|
gxsforums_ds->resetDataStore(); //TODO: remove, new service data per RS session, for testing
|
||||||
|
#endif
|
||||||
|
|
||||||
mGxsForums = new p3GxsForums(gxsforums_ds, NULL);
|
mGxsForums = new p3GxsForums(gxsforums_ds, NULL);
|
||||||
|
|
||||||
|
|
|
@ -118,7 +118,13 @@ p3GxsCircles::p3GxsCircles(RsGeneralDataService *gds, RsNetworkExchangeService *
|
||||||
RsTickEvent::schedule_now(CIRCLE_EVENT_LOADIDS);
|
RsTickEvent::schedule_now(CIRCLE_EVENT_LOADIDS);
|
||||||
|
|
||||||
// Dummy Circles.
|
// Dummy Circles.
|
||||||
|
|
||||||
|
#ifndef GXS_DEV_TESTNET // NO RESET, OR DUMMYDATA for TESTNET
|
||||||
|
|
||||||
RsTickEvent::schedule_in(CIRCLE_EVENT_DUMMYSTART, CIRCLE_DUMMY_STARTPERIOD);
|
RsTickEvent::schedule_in(CIRCLE_EVENT_DUMMYSTART, CIRCLE_DUMMY_STARTPERIOD);
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -55,7 +55,13 @@ p3GxsForums::p3GxsForums(RsGeneralDataService *gds, RsNetworkExchangeService *ne
|
||||||
{
|
{
|
||||||
// For Dummy Msgs.
|
// For Dummy Msgs.
|
||||||
mGenActive = false;
|
mGenActive = false;
|
||||||
|
|
||||||
|
#ifndef GXS_DEV_TESTNET // NO RESET, OR DUMMYDATA for TESTNET
|
||||||
|
|
||||||
RsTickEvent::schedule_in(FORUM_TESTEVENT_DUMMYDATA, DUMMYDATA_PERIOD);
|
RsTickEvent::schedule_in(FORUM_TESTEVENT_DUMMYDATA, DUMMYDATA_PERIOD);
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void p3GxsForums::notifyChanges(std::vector<RsGxsNotify *> &changes)
|
void p3GxsForums::notifyChanges(std::vector<RsGxsNotify *> &changes)
|
||||||
|
|
|
@ -38,11 +38,11 @@
|
||||||
|
|
||||||
/****
|
/****
|
||||||
* #define ID_DEBUG 1
|
* #define ID_DEBUG 1
|
||||||
|
* #define GXSID_GEN_DUMMY_DATA 1
|
||||||
****/
|
****/
|
||||||
|
|
||||||
#define GXSID_GEN_DUMMY_DATA 1
|
#define GXSID_GEN_DUMMY_DATA 1
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#define ID_REQUEST_LIST 0x0001
|
#define ID_REQUEST_LIST 0x0001
|
||||||
#define ID_REQUEST_IDENTITY 0x0002
|
#define ID_REQUEST_IDENTITY 0x0002
|
||||||
#define ID_REQUEST_REPUTATION 0x0003
|
#define ID_REQUEST_REPUTATION 0x0003
|
||||||
|
@ -129,14 +129,18 @@ p3IdService::p3IdService(RsGeneralDataService *gds, RsNetworkExchangeService *ne
|
||||||
mBgSchedule_Active = false;
|
mBgSchedule_Active = false;
|
||||||
|
|
||||||
// Kick off Cache Testing, + Others.
|
// Kick off Cache Testing, + Others.
|
||||||
RsTickEvent::schedule_in(GXSID_EVENT_CACHETEST, CACHETEST_PERIOD);
|
|
||||||
RsTickEvent::schedule_in(GXSID_EVENT_PGPHASH, PGPHASH_PERIOD);
|
RsTickEvent::schedule_in(GXSID_EVENT_PGPHASH, PGPHASH_PERIOD);
|
||||||
RsTickEvent::schedule_in(GXSID_EVENT_REPUTATION, REPUTATION_PERIOD);
|
RsTickEvent::schedule_in(GXSID_EVENT_REPUTATION, REPUTATION_PERIOD);
|
||||||
RsTickEvent::schedule_now(GXSID_EVENT_CACHEOWNIDS);
|
RsTickEvent::schedule_now(GXSID_EVENT_CACHEOWNIDS);
|
||||||
|
|
||||||
|
#ifndef GXS_DEV_TESTNET // NO RESET, OR DUMMYDATA for TESTNET
|
||||||
|
|
||||||
|
RsTickEvent::schedule_in(GXSID_EVENT_CACHETEST, CACHETEST_PERIOD);
|
||||||
|
|
||||||
#ifdef GXSID_GEN_DUMMY_DATA
|
#ifdef GXSID_GEN_DUMMY_DATA
|
||||||
RsTickEvent::schedule_now(GXSID_EVENT_DUMMYDATA);
|
RsTickEvent::schedule_now(GXSID_EVENT_DUMMYDATA);
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1156,6 +1160,9 @@ static void calcPGPHash(const RsGxsId &id, const PGPFingerprintType &pgp, GxsIdP
|
||||||
// Must Use meta.
|
// Must Use meta.
|
||||||
void p3IdService::service_CreateGroup(RsGxsGrpItem* grpItem, RsTlvSecurityKeySet& keySet)
|
void p3IdService::service_CreateGroup(RsGxsGrpItem* grpItem, RsTlvSecurityKeySet& keySet)
|
||||||
{
|
{
|
||||||
|
std::cerr << "p3IdService::service_CreateGroup()";
|
||||||
|
std::cerr << std::endl;
|
||||||
|
|
||||||
RsGxsIdGroupItem *item = dynamic_cast<RsGxsIdGroupItem *>(grpItem);
|
RsGxsIdGroupItem *item = dynamic_cast<RsGxsIdGroupItem *>(grpItem);
|
||||||
if (!item)
|
if (!item)
|
||||||
{
|
{
|
||||||
|
@ -1219,29 +1226,25 @@ void p3IdService::service_CreateGroup(RsGxsGrpItem* grpItem, RsTlvSecurityKeySet
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
std::cerr << "p3IdService::service_CreateGroup() for : " << item->group.mMeta.mGroupId;
|
std::cerr << "p3IdService::service_CreateGroup() for : " << item->group.mMeta.mGroupId;
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
std::cerr << "p3IdService::service_CreateGroup() Alt GroupId : " << item->meta.mGroupId;
|
std::cerr << "p3IdService::service_CreateGroup() Alt GroupId : " << item->meta.mGroupId;
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
|
|
||||||
#ifdef GXSID_GEN_DUMMY_DATA
|
|
||||||
if ((item->group.mMeta.mGroupFlags & RSGXSID_GROUPFLAG_REALID) && (item->group.mMeta.mAuthorId != ""))
|
|
||||||
#else
|
|
||||||
if (item->group.mMeta.mGroupFlags & RSGXSID_GROUPFLAG_REALID)
|
if (item->group.mMeta.mGroupFlags & RSGXSID_GROUPFLAG_REALID)
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
/* create the hash */
|
/* create the hash */
|
||||||
GxsIdPgpHash hash;
|
GxsIdPgpHash hash;
|
||||||
|
|
||||||
/* */
|
/* */
|
||||||
PGPFingerprintType ownFinger;
|
PGPFingerprintType ownFinger;
|
||||||
#ifdef GXSID_GEN_DUMMY_DATA
|
|
||||||
PGPIdType ownId(item->group.mMeta.mAuthorId);
|
|
||||||
#else
|
|
||||||
PGPIdType ownId(AuthGPG::getAuthGPG()->getGPGOwnId());
|
PGPIdType ownId(AuthGPG::getAuthGPG()->getGPGOwnId());
|
||||||
|
|
||||||
|
#ifdef GXSID_GEN_DUMMY_DATA
|
||||||
|
if (item->group.mMeta.mAuthorId != "")
|
||||||
|
{
|
||||||
|
ownId = PGPIdType(item->group.mMeta.mAuthorId);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!AuthGPG::getAuthGPG()->getKeyFingerprint(ownId,ownFinger))
|
if (!AuthGPG::getAuthGPG()->getKeyFingerprint(ownId,ownFinger))
|
||||||
|
@ -1254,6 +1257,9 @@ void p3IdService::service_CreateGroup(RsGxsGrpItem* grpItem, RsTlvSecurityKeySet
|
||||||
calcPGPHash(item->group.mMeta.mGroupId, ownFinger, hash);
|
calcPGPHash(item->group.mMeta.mGroupId, ownFinger, hash);
|
||||||
item->group.mPgpIdHash = hash.toStdString();
|
item->group.mPgpIdHash = hash.toStdString();
|
||||||
|
|
||||||
|
std::cerr << "p3IdService::service_CreateGroup() Calculated PgpIdHash : " << item->group.mPgpIdHash;
|
||||||
|
std::cerr << std::endl;
|
||||||
|
|
||||||
/* do signature */
|
/* do signature */
|
||||||
|
|
||||||
#if ENABLE_PGP_SIGNATURES
|
#if ENABLE_PGP_SIGNATURES
|
||||||
|
@ -1526,6 +1532,17 @@ bool p3IdService::checkId(const RsGxsIdGroup &grp, PGPIdType &pgpId)
|
||||||
std::cerr << grp.mMeta.mGroupId;
|
std::cerr << grp.mMeta.mGroupId;
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
|
|
||||||
|
/* some sanity checking... make sure hash is the right size */
|
||||||
|
|
||||||
|
std::cerr << "p3IdService::checkId() PgpIdHash is: " << grp.mPgpIdHash;
|
||||||
|
std::cerr << std::endl;
|
||||||
|
|
||||||
|
if (grp.mPgpIdHash.length() != SHA_DIGEST_LENGTH * 2)
|
||||||
|
{
|
||||||
|
std::cerr << "ERROR PgpIdHash len:" << grp.mPgpIdHash.length();
|
||||||
|
std::cerr << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
/* iterate through and check hash */
|
/* iterate through and check hash */
|
||||||
GxsIdPgpHash ans(grp.mPgpIdHash);
|
GxsIdPgpHash ans(grp.mPgpIdHash);
|
||||||
|
|
||||||
|
|
|
@ -94,6 +94,8 @@ p3PhotoService::p3PhotoService(RsGeneralDataService* gds, RsNetworkExchangeServi
|
||||||
|
|
||||||
// create dummy grps
|
// create dummy grps
|
||||||
|
|
||||||
|
#ifndef GXS_DEV_TESTNET // NO RESET, OR DUMMYDATA for TESTNET
|
||||||
|
|
||||||
RsGxsPhotoAlbumItem* item1 = new RsGxsPhotoAlbumItem(), *item2 = new RsGxsPhotoAlbumItem();
|
RsGxsPhotoAlbumItem* item1 = new RsGxsPhotoAlbumItem(), *item2 = new RsGxsPhotoAlbumItem();
|
||||||
|
|
||||||
item1->meta.mGroupName = "Dummy Album 1";
|
item1->meta.mGroupName = "Dummy Album 1";
|
||||||
|
@ -105,6 +107,10 @@ p3PhotoService::p3PhotoService(RsGeneralDataService* gds, RsNetworkExchangeServi
|
||||||
|
|
||||||
createDummyGroup(item1);
|
createDummyGroup(item1);
|
||||||
createDummyGroup(item2);
|
createDummyGroup(item2);
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool p3PhotoService::updated()
|
bool p3PhotoService::updated()
|
||||||
|
|
|
@ -64,10 +64,14 @@ void p3Posted::notifyChanges(std::vector<RsGxsNotify *> &changes)
|
||||||
void p3Posted::service_tick()
|
void p3Posted::service_tick()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
#ifndef GXS_DEV_TESTNET // DISABLE DUMMYDATA if TEST_NET
|
||||||
|
|
||||||
generateTopics();
|
generateTopics();
|
||||||
generatePosts();
|
generatePosts();
|
||||||
generateVotesAndComments();
|
generateVotesAndComments();
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
// time_t now = time(NULL);
|
// time_t now = time(NULL);
|
||||||
//
|
//
|
||||||
// if((now > (time_t) (VOTE_UPDATE_PERIOD + mLastUpdate)) &&
|
// if((now > (time_t) (VOTE_UPDATE_PERIOD + mLastUpdate)) &&
|
||||||
|
|
|
@ -54,9 +54,11 @@ p3Wiki::p3Wiki(RsGeneralDataService* gds, RsNetworkExchangeService* nes)
|
||||||
mImprovActive = false;
|
mImprovActive = false;
|
||||||
mMarkdownActive = false;
|
mMarkdownActive = false;
|
||||||
|
|
||||||
|
#ifndef GXS_DEV_TESTNET // NO RESET, OR DUMMYDATA for TESTNET
|
||||||
#ifdef WIKI_GEN_DUMMY_DATA
|
#ifdef WIKI_GEN_DUMMY_DATA
|
||||||
RsTickEvent::schedule_in(WIKI_EVENT_DUMMYSTART, DUMMYSTART_PERIOD);
|
RsTickEvent::schedule_in(WIKI_EVENT_DUMMYSTART, DUMMYSTART_PERIOD);
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue