fixed ftserver3test. Apparently cache items are not transferring ok

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@6040 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
csoler 2012-12-26 21:25:08 +00:00
parent cf947e7b7c
commit 9cf6db3051
3 changed files with 48 additions and 27 deletions

View File

@ -47,8 +47,8 @@ ftserver1test : ftserver1test.o pqitestor.o
ftserver2test : ftserver2test.o pqitestor.o
$(CC) $(CFLAGS) -o ftserver2test ftserver2test.o pqitestor.o $(LIBS)
ftserver3test : ftserver3test.o
$(CC) $(CFLAGS) -o ftserver3test ftserver3test.o $(LIBS)
ftserver3test : ftserver3test.o pqitestor.o
$(CC) $(CFLAGS) -o ftserver3test ftserver3test.o pqitestor.o $(LIBS)
ftcrc32test : ftcrc32test.o
$(CC) $(CFLAGS) -O0 -g -o ftcrc32test ftcrc32test.o $(LIBS)

View File

@ -48,10 +48,14 @@
#include "ft/ftdatamultiplex.h"
#include "ft/ftfilesearch.h"
//#include "pqi/p3authmgr.h"
//#include "pqi/p3connmgr.h"
#include "pqi/p3linkmgr.h"
#include "pqi/p3peermgr.h"
#include "pqi/p3netmgr.h"
#include "util/rsdebug.h"
#include "util/utest.h"
#include "common/testutils.h"
#include "retroshare/rsiface.h"
#include "pqitestor.h"
#include "util/rsdir.h"
@ -93,7 +97,7 @@ int main(int argc, char **argv)
std::list<std::string> extraList;
std::list<std::string> peerIds;
std::map<std::string, ftServer *> mFtServers;
std::map<std::string, p3ConnectMgr *> mConnMgrs;
std::map<std::string, p3LinkMgrIMPL *> mLinkMgrs;
ftServer *mLoadServer = NULL;
std::list<ftServer *> mOtherServers;
@ -170,6 +174,16 @@ int main(int argc, char **argv)
fileList.push_back(info) ;
}
std::cerr << "Point 2" << std::endl;
std::string ssl_own_id = TestUtils::createRandomSSLId() ;
std::string gpg_own_id = TestUtils::createRandomPGPId() ;
TestUtils::DummyAuthGPG fakeGPG(gpg_own_id) ;
AuthGPG::setAuthGPG_debug(&fakeGPG) ;
TestUtils::DummyAuthSSL fakeSSL(ssl_own_id) ;
AuthSSL::setAuthSSL_debug(&fakeSSL) ;
/* We need to setup a series 2 - 4 different ftServers....
*
@ -181,8 +195,8 @@ int main(int argc, char **argv)
std::list<std::string>::const_iterator it, jit;
std::list<pqiAuthDetails> baseFriendList, friendList;
std::list<pqiAuthDetails>::iterator fit;
std::list<RsPeerDetails> baseFriendList, friendList;
std::list<RsPeerDetails>::iterator fit;
/* Add in Serialiser Test
*/
@ -197,17 +211,17 @@ int main(int argc, char **argv)
/* Setup Base Friend Info */
for(it = peerIds.begin(); it != peerIds.end(); it++)
{
pqiAuthDetails pad;
RsPeerDetails pad;
pad.id = *it;
pad.gpg_id = TestUtils::createRandomPGPId() ;
pad.name = *it;
pad.trustLvl = 5;
pad.ownsign = true;
pad.trusted = false;
//pad.trusted = false;
baseFriendList.push_back(pad);
std::cerr << "ftserver1test::setup peer: " << *it;
std::cerr << std::endl;
std::cerr << "ftserver1test::setup peer: " << *it << std::endl;
}
std::ostringstream pname;
@ -231,22 +245,26 @@ int main(int argc, char **argv)
}
}
p3AuthMgr *authMgr = new p3DummyAuthMgr(*it, friendList);
p3ConnectMgr *connMgr = new p3ConnectMgr(authMgr);
mConnMgrs[*it] = connMgr;
//p3AuthMgr *authMgr = new p3DummyAuthMgr(*it, friendList);
p3PeerMgrIMPL *peerMgr = new p3PeerMgrIMPL(ssl_own_id,gpg_own_id,"My GPG name","My SSL location");
p3NetMgrIMPL *netMgr = new p3NetMgrIMPL ;
p3LinkMgrIMPL *linkMgr = new p3LinkMgrIMPL(peerMgr,netMgr);
mLinkMgrs[*it] = linkMgr;
rsPeers = new TestUtils::DummyRsPeers(linkMgr,peerMgr,netMgr) ;
for(fit = friendList.begin(); fit != friendList.end(); fit++)
{
/* add as peer to authMgr */
connMgr->addFriend(fit->id);
peerMgr->addFriend(fit->id,fit->gpg_id);
}
P3Pipe *pipe = new P3Pipe(); //(*it);
/* add server */
ftServer *server;
server = new ftServer(authMgr, connMgr);
server = new ftServer(peerMgr,linkMgr);
mFtServers[*it] = server;
bool isOther;
if (!mLoadServer)
@ -283,10 +301,12 @@ int main(int argc, char **argv)
server->setConfigDirectory(configpath);
NotifyBase *base = NULL;
//sleep(60);
NotifyBase *base = new NotifyBase;
server->SetupFtServer(base);
testHub->addP3Pipe(*it, pipe, connMgr);
testHub->addP3Pipe(*it, pipe, linkMgr);
server->StartupThreads();
/* setup any extra bits */
@ -298,7 +318,7 @@ int main(int argc, char **argv)
server->setSharedDirectories(fileList);
for(eit = extraList.begin(); eit != extraList.end(); eit++)
{
server->ExtraFileHash(*eit, 3600, 0);
server->ExtraFileHash(*eit, 3600, TransferRequestFlags(0));
}
}
@ -309,14 +329,14 @@ int main(int argc, char **argv)
mLoadServer->setSharedDirectories(fileList);
for(eit = extraList.begin(); eit != extraList.end(); eit++)
{
mLoadServer->ExtraFileHash(*eit, 3600, 0);
mLoadServer->ExtraFileHash(*eit, 3600, TransferRequestFlags(0));
}
}
/* stick your real test here */
std::map<std::string, ftServer *>::iterator sit;
std::map<std::string, p3ConnectMgr *>::iterator cit;
std::map<std::string, p3LinkMgrIMPL *>::iterator cit;
/* Start up test thread */
pthread_t tid;
@ -344,7 +364,7 @@ int main(int argc, char **argv)
(sit->second)->tick();
}
for(cit = mConnMgrs.begin(); cit != mConnMgrs.end(); cit++)
for(cit = mLinkMgrs.begin(); cit != mLinkMgrs.end(); cit++)
{
/* update */
(cit->second)->tick();
@ -390,9 +410,9 @@ void *do_server_test_thread(void *data)
std::string oId = oServer->OwnId();
/* create Expression */
uint64_t minFileSize = 100000;
//SizeExpression se(Greater, minFileSize);
SizeExpression se(Smaller, minFileSize);
uint64_t minFileSize = 1000;
SizeExpression se(Greater, minFileSize);
//SizeExpression se(Smaller, minFileSize);
Expression *expr = &se;
std::list<DirDetails> results;
@ -450,8 +470,7 @@ void *do_server_test_thread(void *data)
//srcIds.push_back(oId);
if (foundFile)
{
mFt->loadServer->FileRequest(sFile.name, sFile.hash,
sFile.size, "", 0, srcIds);
mFt->loadServer->FileRequest(sFile.name, sFile.hash, sFile.count, "", TransferRequestFlags(0), srcIds);
}
/* Give it a while to transfer */

View File

@ -0,0 +1,2 @@
#!/bin/sh
./ftserver3test -p 8cb3a1677872c9e8248fd5ddeac84000 -p 8cb3a1677872c9e8248fd5ddeac84001 -p 8cb3a1677872c9e8248fd5ddeac84002 . ftserver3test