mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-02 22:25:04 -04:00
Fix: DHT cannot bootstrap if bdboot.txt is corrupted.
If the bdboot.txt file is broken in profile folder, attempt to load the data from the file installed with RS.
This commit is contained in:
parent
9c13dc2ff8
commit
a97d0ff15c
11 changed files with 41 additions and 23 deletions
|
@ -113,8 +113,8 @@ virtual int dhtInfoCallback(const bdId *id, uint32_t type, uint32_t flags, std::
|
|||
};
|
||||
|
||||
|
||||
p3BitDht::p3BitDht(const RsPeerId& id, pqiConnectCb *cb, p3NetMgr *nm,
|
||||
UdpStack *udpstack, std::string bootstrapfile,const std::string& filteredipfile)
|
||||
p3BitDht::p3BitDht(const RsPeerId& id, pqiConnectCb *cb, p3NetMgr *nm,
|
||||
UdpStack *udpstack, std::string bootstrapfile, std::string bootstrapfilebak, const std::string& filteredipfile)
|
||||
:p3Config(), pqiNetAssistConnect(id, cb), mNetMgr(nm), dhtMtx("p3BitDht")
|
||||
{
|
||||
#ifdef RS_USE_DHT_STUNNER
|
||||
|
@ -163,7 +163,7 @@ p3BitDht::p3BitDht(const RsPeerId& id, pqiConnectCb *cb, p3NetMgr *nm,
|
|||
#endif
|
||||
|
||||
/* create dht */
|
||||
mUdpBitDht = new UdpBitDht(udpstack, &mOwnDhtId, dhtVersion, bootstrapfile, filteredipfile,mDhtFns);
|
||||
mUdpBitDht = new UdpBitDht(udpstack, &mOwnDhtId, dhtVersion, bootstrapfile, bootstrapfilebak, filteredipfile,mDhtFns);
|
||||
udpstack->addReceiver(mUdpBitDht);
|
||||
|
||||
/* setup callback to here */
|
||||
|
|
|
@ -141,7 +141,7 @@ class p3BitDht: public p3Config, public pqiNetAssistConnect, public RsDht
|
|||
{
|
||||
public:
|
||||
p3BitDht(const RsPeerId& id, pqiConnectCb *cb, p3NetMgr *nm,
|
||||
UdpStack *udpstack, std::string bootstrapfile, const std::string &filteredipfile);
|
||||
UdpStack *udpstack, std::string bootstrapfile, std::string bootstrapfilebak, const std::string &filteredipfile);
|
||||
|
||||
|
||||
virtual ~p3BitDht();
|
||||
|
|
|
@ -989,6 +989,13 @@ int RsServer::StartupRetroShare()
|
|||
bootstrapfile += "/";
|
||||
bootstrapfile += BITDHT_BOOTSTRAP_FILENAME;
|
||||
|
||||
std::string installfile = "";
|
||||
#ifndef __ANDROID__
|
||||
installfile = RsAccounts::systemDataDirectory();
|
||||
installfile += "/";
|
||||
installfile += BITDHT_BOOTSTRAP_FILENAME;
|
||||
#endif
|
||||
|
||||
std::string filteredipfile = RsAccounts::AccountDirectory();
|
||||
if (filteredipfile != "")
|
||||
filteredipfile += "/";
|
||||
|
@ -1029,10 +1036,6 @@ int RsServer::StartupRetroShare()
|
|||
bdbootRF.close();
|
||||
}
|
||||
#else
|
||||
std::string installfile = RsAccounts::systemDataDirectory();
|
||||
installfile += "/";
|
||||
installfile += BITDHT_BOOTSTRAP_FILENAME;
|
||||
|
||||
std::cerr << "Checking for Installation DHT bootstrap file " << installfile << std::endl;
|
||||
if ((installfile != "") && (RsDirUtil::checkFile(installfile,tmp_size)))
|
||||
{
|
||||
|
@ -1080,7 +1083,7 @@ int RsServer::StartupRetroShare()
|
|||
// NEXT BITDHT.
|
||||
|
||||
|
||||
mBitDht = new p3BitDht(ownId, mLinkMgr, mNetMgr, mDhtStack, bootstrapfile, filteredipfile);
|
||||
mBitDht = new p3BitDht(ownId, mLinkMgr, mNetMgr, mDhtStack, bootstrapfile, installfile, filteredipfile);
|
||||
|
||||
// NEXT THE RELAY (NEED to keep a reference for installing RELAYS)
|
||||
UdpRelayReceiver *mRelay = new UdpRelayReceiver(mDhtStack);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue