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

@ -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;
}