More bugfixes for file transfer stuff.

* Completed 2 basic tests (ftserver1test & ftserver2test)
 * Updated test notes.
 * debugging stderr output. 
 * fixed return code in ftfilesearch.cc
 * corrected ftcontroller run() to call fttransfermodule::tick()
 * fixed ONLINE status for OwnId (ftcontroller too)
 * corrected message sources for test harness.



git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@705 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
drbob 2008-08-21 21:30:59 +00:00
parent 08285b512d
commit 7b7446c5b5
9 changed files with 518 additions and 44 deletions

View file

@ -83,19 +83,25 @@ void ftController::setFtSearch(ftSearch *search)
void ftController::run()
{
/* check the queues */
std::cerr << "ftController::run()";
std::cerr << std::endl;
/* tick the transferModules */
RsStackMutex stack(ctrlMutex); /******* LOCKED ********/
std::map<std::string, ftFileControl>::iterator it;
for(it = mDownloads.begin(); it != mDownloads.end(); it++)
while(1)
{
std::cerr << "\tTicking: " << it->first;
sleep(1);
std::cerr << "ftController::run()";
std::cerr << std::endl;
(it->second.mTransfer)->tick();
/* tick the transferModules */
RsStackMutex stack(ctrlMutex); /******* LOCKED ********/
std::map<std::string, ftFileControl>::iterator it;
for(it = mDownloads.begin(); it != mDownloads.end(); it++)
{
std::cerr << "\tTicking: " << it->first;
std::cerr << std::endl;
(it->second.mTransfer)->tick();
}
}
}
@ -223,17 +229,30 @@ bool ftController::FileRequest(std::string fname, std::string hash,
tm->setFileSources(srcIds);
/* get current state for transfer module */
std::string ownId = mConnMgr->getOwnId();
for(it = srcIds.begin(); it != srcIds.end(); it++)
{
if (mConnMgr->isOnline(*it))
if (*it == ownId)
{
#ifdef CONTROL_DEBUG
std::cerr << "ftController::FileRequest()";
std::cerr << *it << " is Self - set high rate";
std::cerr << std::endl;
#endif
//tm->setPeerState(*it, RS_FILE_RATE_FAST |
// RS_FILE_PEER_ONLINE, 100000);
tm->setPeerState(*it, PQIPEER_IDLE, 10000);
}
else if (mConnMgr->isOnline(*it))
{
#ifdef CONTROL_DEBUG
std::cerr << "ftController::FileRequest()";
std::cerr << *it << " is Online";
std::cerr << std::endl;
#endif
tm->setPeerState(*it, RS_FILE_RATE_TRICKLE |
RS_FILE_PEER_ONLINE, 10000);
//tm->setPeerState(*it, RS_FILE_RATE_TRICKLE |
// RS_FILE_PEER_ONLINE, 10000);
tm->setPeerState(*it, PQIPEER_IDLE, 10000);
}
else
{
@ -242,7 +261,8 @@ bool ftController::FileRequest(std::string fname, std::string hash,
std::cerr << *it << " is Offline";
std::cerr << std::endl;
#endif
tm->setPeerState(*it, RS_FILE_PEER_OFFLINE, 10000);
//tm->setPeerState(*it, RS_FILE_PEER_OFFLINE, 10000);
tm->setPeerState(*it, PQIPEER_NOT_ONLINE, 10000);
}
}