mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
* added OwnId at p3bitdht level.
* Filter out own id from stun peers. git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5-netupgrade@4438 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
42dd1826b0
commit
9ec411345d
@ -85,7 +85,7 @@ p3BitDht::p3BitDht(std::string id, pqiConnectCb *cb, p3NetMgr *nm,
|
|||||||
mRelay = NULL;
|
mRelay = NULL;
|
||||||
|
|
||||||
std::string dhtVersion = "RS51"; // should come from elsewhere!
|
std::string dhtVersion = "RS51"; // should come from elsewhere!
|
||||||
bdNodeId ownId;
|
mOwnRsId = id;
|
||||||
|
|
||||||
#ifdef DEBUG_BITDHT
|
#ifdef DEBUG_BITDHT
|
||||||
std::cerr << "p3BitDht::p3BitDht()" << std::endl;
|
std::cerr << "p3BitDht::p3BitDht()" << std::endl;
|
||||||
@ -99,12 +99,12 @@ p3BitDht::p3BitDht(std::string id, pqiConnectCb *cb, p3NetMgr *nm,
|
|||||||
|
|
||||||
/* setup ownId */
|
/* setup ownId */
|
||||||
storeTranslation_locked(id);
|
storeTranslation_locked(id);
|
||||||
lookupNodeId_locked(id, &ownId);
|
lookupNodeId_locked(id, &mOwnDhtId);
|
||||||
|
|
||||||
|
|
||||||
#ifdef DEBUG_BITDHT
|
#ifdef DEBUG_BITDHT
|
||||||
std::cerr << "Own NodeId: ";
|
std::cerr << "Own NodeId: ";
|
||||||
bdStdPrintNodeId(std::cerr, &ownId);
|
bdStdPrintNodeId(std::cerr, &mOwnDhtId);
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -117,7 +117,7 @@ p3BitDht::p3BitDht(std::string id, pqiConnectCb *cb, p3NetMgr *nm,
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* create dht */
|
/* create dht */
|
||||||
mUdpBitDht = new UdpBitDht(udpstack, &ownId, dhtVersion, bootstrapfile, stdfns);
|
mUdpBitDht = new UdpBitDht(udpstack, &mOwnDhtId, dhtVersion, bootstrapfile, stdfns);
|
||||||
udpstack->addReceiver(mUdpBitDht);
|
udpstack->addReceiver(mUdpBitDht);
|
||||||
|
|
||||||
/* setup callback to here */
|
/* setup callback to here */
|
||||||
|
@ -249,6 +249,9 @@ int calculateNodeId(const std::string pid, bdNodeId *id);
|
|||||||
|
|
||||||
RsMutex dhtMtx;
|
RsMutex dhtMtx;
|
||||||
|
|
||||||
|
std::string mOwnRsId;
|
||||||
|
bdNodeId mOwnDhtId;
|
||||||
|
|
||||||
time_t mMinuteTS;
|
time_t mMinuteTS;
|
||||||
|
|
||||||
/* translation maps */
|
/* translation maps */
|
||||||
|
@ -186,6 +186,20 @@ int p3BitDht::NodeCallback(const bdId *id, uint32_t peerflags)
|
|||||||
* ideally don't pass to both peers... (XXX do later)
|
* ideally don't pass to both peers... (XXX do later)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
{
|
||||||
|
RsStackMutex stack(dhtMtx); /********** LOCKED MUTEX ***************/
|
||||||
|
if (id->id == mOwnDhtId)
|
||||||
|
{
|
||||||
|
#ifdef DEBUG_BITDHT_COMMON
|
||||||
|
std::cerr << "p3BitDht::NodeCallback() Skipping own id";
|
||||||
|
bdStdPrintId(std::cerr, id);
|
||||||
|
std::cerr << std::endl;
|
||||||
|
#endif
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if ((mProxyStunner) && (mProxyStunner->needStunPeers()))
|
if ((mProxyStunner) && (mProxyStunner->needStunPeers()))
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_BITDHT_COMMON
|
#ifdef DEBUG_BITDHT_COMMON
|
||||||
|
Loading…
Reference in New Issue
Block a user