mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-07-27 16:35:21 -04:00
Expanded DHT history analysis, and ran some more tests on DHT behaviour.
- Tweaked query parameters (quicker discard, longer requery period). The analysis suggests that in general the DHT is running okay with some minor issues. - BitDHT peers respond to ~50% of FIND_NODE queries. This means we drop them, and so some ONLINE friends, become UNREACHABLE friends. This appears to be caused by too many FIND_NODE queries reaching BitDHT, and the peer starts dropping them. This appears to come from specific peers, which are not RS nodes. Proposed solution is to Track and Filter Over-Querying Peers. (Only one query per peer every 30 seconds). - Should be more lenient on the exact query matches. Allow some dropped messages. - Queries appear to run longer than necessary. A better query completion criteria needs to be established. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@6614 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
1554e17f48
commit
0608f67d71
6 changed files with 488 additions and 98 deletions
|
@ -3,6 +3,7 @@
|
|||
|
||||
#include "bitdht/bdpeer.h"
|
||||
#include "bitdht/bdobj.h"
|
||||
#include "bitdht/bdstddht.h"
|
||||
#include <map>
|
||||
|
||||
#define MSG_TYPE_DIRECTION_MASK 0x000f0000
|
||||
|
@ -14,30 +15,80 @@
|
|||
|
||||
class MsgRegister
|
||||
{
|
||||
public:
|
||||
MsgRegister() { return; }
|
||||
MsgRegister(const bdId *inId, uint32_t inMsgType, bool inIncoming)
|
||||
:id(*inId), msgType(inMsgType), incoming(inIncoming) { return; }
|
||||
public:
|
||||
MsgRegister() { return; }
|
||||
MsgRegister(const bdId *inId, uint32_t inMsgType, bool inIncoming, const bdNodeId *inAboutId)
|
||||
:id(*inId), msgType(inMsgType), incoming(inIncoming)
|
||||
{
|
||||
if (inAboutId)
|
||||
{
|
||||
aboutId = *inAboutId;
|
||||
}
|
||||
else
|
||||
{
|
||||
bdStdZeroNodeId(&aboutId);
|
||||
}
|
||||
|
||||
bdId id;
|
||||
uint32_t msgType;
|
||||
bool incoming;
|
||||
return;
|
||||
}
|
||||
|
||||
bdId id;
|
||||
uint32_t msgType;
|
||||
bool incoming;
|
||||
bdNodeId aboutId; // filled in for queries.
|
||||
};
|
||||
|
||||
|
||||
class bdMsgHistoryItem
|
||||
{
|
||||
public:
|
||||
bdMsgHistoryItem()
|
||||
:msgType(0), incoming(false)
|
||||
{
|
||||
bdStdZeroNodeId(&aboutId);
|
||||
return;
|
||||
}
|
||||
|
||||
bdMsgHistoryItem(uint32_t inMsgType, bool inIncoming, const bdNodeId *inAboutId)
|
||||
:msgType(inMsgType), incoming(inIncoming)
|
||||
{
|
||||
if (inAboutId)
|
||||
{
|
||||
aboutId = *inAboutId;
|
||||
}
|
||||
else
|
||||
{
|
||||
bdStdZeroNodeId(&aboutId);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
uint32_t msgType;
|
||||
bool incoming;
|
||||
bdNodeId aboutId; // filled in for queries.
|
||||
};
|
||||
|
||||
|
||||
class bdMsgHistoryList
|
||||
{
|
||||
public:
|
||||
void addMsg(time_t ts, uint32_t msgType, bool incoming);
|
||||
bdMsgHistoryList();
|
||||
void addMsg(time_t ts, uint32_t msgType, bool incoming, const bdNodeId *aboutId);
|
||||
void setPeerType(time_t ts, std::string version);
|
||||
int msgCount(time_t start_ts, time_t end_ts);
|
||||
bool msgClear(time_t before); // 0 => clear all.
|
||||
bool msgClear(time_t before); // 0 => clear all.
|
||||
void msgClear();
|
||||
void printHistory(std::ostream &out, int mode, time_t start_ts, time_t end_ts);
|
||||
bool analysePeer();
|
||||
void clearHistory();
|
||||
|
||||
bool canSend();
|
||||
bool validPeer();
|
||||
|
||||
std::multimap<time_t, uint32_t> msgHistory;
|
||||
std::multimap<time_t, bdMsgHistoryItem> msgHistory;
|
||||
std::string mPeerVersion;
|
||||
bdId mId;
|
||||
};
|
||||
|
||||
|
||||
|
@ -45,13 +96,16 @@ bool validPeer();
|
|||
class bdHistory
|
||||
{
|
||||
public:
|
||||
bdHistory(time_t store_period);
|
||||
bdHistory(time_t store_period);
|
||||
|
||||
void addMsg(const bdId *id, bdToken *transId, uint32_t msgType, bool incoming);
|
||||
void addMsg(const bdId *id, bdToken *transId, uint32_t msgType, bool incoming, const bdNodeId *aboutId);
|
||||
void setPeerType(const bdId *id, std::string version);
|
||||
void printMsgs();
|
||||
|
||||
void cleanupOldMsgs();
|
||||
void cleanupOldMsgs();
|
||||
void clearHistory();
|
||||
bool analysePeers();
|
||||
bool peerTypeAnalysis();
|
||||
|
||||
bool canSend(const bdId *id);
|
||||
bool validPeer(const bdId *id);
|
||||
|
@ -59,9 +113,10 @@ bool validPeer(const bdId *id);
|
|||
/* recent history */
|
||||
//std::list<bdId> lastMsgs;
|
||||
std::map<bdId, bdMsgHistoryList> mHistory;
|
||||
std::multimap<time_t, MsgRegister> mMsgTimeline;
|
||||
std::multimap<time_t, MsgRegister> mMsgTimeline;
|
||||
|
||||
int mStorePeriod;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue