diff --git a/src/bitdht/bdconnection.cc b/src/bitdht/bdconnection.cc index 8e5dd64..ebce696 100644 --- a/src/bitdht/bdconnection.cc +++ b/src/bitdht/bdconnection.cc @@ -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)) { diff --git a/src/bitdht/bdconnection.h b/src/bitdht/bdconnection.h index 9b62725..10be0f6 100644 --- a/src/bitdht/bdconnection.h +++ b/src/bitdht/bdconnection.h @@ -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 */ diff --git a/src/bitdht/bdnode.cc b/src/bitdht/bdnode.cc index 9200965..23fbe4a 100644 --- a/src/bitdht/bdnode.cc +++ b/src/bitdht/bdnode.cc @@ -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) diff --git a/src/bitdht/bdquery.cc b/src/bitdht/bdquery.cc index b52d1525..87a9bdd 100644 --- a/src/bitdht/bdquery.cc +++ b/src/bitdht/bdquery.cc @@ -101,9 +101,13 @@ bool bdQuery::result(std::list &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; }