Reduced timeout for connections to 20 secs. because they should be quick.

Made the query more robust, by only saying a query is SUCCESSFUL if we have recvd a reply from peer.
NB: These changes are yet to be tested!



git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5-netupgrade@4439 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
drbob 2011-07-13 11:37:47 +00:00
parent 9ec411345d
commit d6938721b0
4 changed files with 13 additions and 6 deletions

View File

@ -1423,6 +1423,8 @@ void bdConnectManager::iterateConnections()
continue;
}
/* Can I add a Quick Kill for connections that just haven't worked? TODO */
if ((it->second.mState == BITDHT_CONNECTION_WAITING_ACK) &&
(now - it->second.mLastStart > BD_CONNECTION_START_RETRY_PERIOD))
{

View File

@ -54,9 +54,9 @@ class bdNodePublisher;
#define BITDHT_CONNECTION_COMPLETED 5
#define BD_CONNECTION_START_RETRY_PERIOD 5 // Should only take a couple of seconds to get reply.
#define BD_CONNECTION_START_RETRY_PERIOD 3 // Should only take a couple of seconds to get reply.
#define BD_CONNECTION_START_MAX_RETRY 3
#define BD_CONNECTION_MAX_TIMEOUT 45
#define BD_CONNECTION_MAX_TIMEOUT 20 /* should be quick */

View File

@ -465,7 +465,7 @@ void bdNode::addPeer(const bdId *id, uint32_t peerflags)
mConnMgr->updatePotentialConnectionProxy(id, peerflags);
//#define DISPLAY_BITDHTNODES 1
#define DISPLAY_BITDHTNODES 1
#ifdef DISPLAY_BITDHTNODES
/* TEMP to extract IDS for BloomFilter */
if (peerflags & BITDHT_PEER_STATUS_DHT_ENGINE)

View File

@ -101,9 +101,13 @@ bool bdQuery::result(std::list<bdId> &answer)
sit = mClosest.begin();
eit = mClosest.upper_bound(mLimit);
int i = 0;
for(; sit != eit; sit++, i++)
for(; sit != eit; sit++)
{
answer.push_back(sit->second.mPeerId);
if ((sit->second).mLastRecvTime != 0)
{
answer.push_back(sit->second.mPeerId);
i++;
}
}
return (i > 0);
}
@ -252,7 +256,8 @@ int bdQuery::nextQuery(bdId &id, bdNodeId &targetNodeId)
/* check if we found the node */
if (mClosest.size() > 0)
{
if ((mClosest.begin()->second).mPeerId.id == mId)
if (((mClosest.begin()->second).mPeerId.id == mId) &&
((mClosest.begin()->second).mLastRecvTime != 0))
{
mState = BITDHT_QUERY_SUCCESS;
}