mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-12-08 19:53:27 +01:00
SQUASHME: fix "Reserve only one network specific cached path per session"
This commit is contained in:
@@ -395,7 +395,8 @@ boost::filesystem::path GetDefaultDataDir()
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static boost::filesystem::path pathCached[2];
|
static boost::filesystem::path pathCached;
|
||||||
|
static boost::filesystem::path pathCachedNetSpecific;
|
||||||
static CCriticalSection csPathCached;
|
static CCriticalSection csPathCached;
|
||||||
|
|
||||||
const boost::filesystem::path &GetDataDir(bool fNetSpecific)
|
const boost::filesystem::path &GetDataDir(bool fNetSpecific)
|
||||||
@@ -404,7 +405,7 @@ const boost::filesystem::path &GetDataDir(bool fNetSpecific)
|
|||||||
|
|
||||||
LOCK(csPathCached);
|
LOCK(csPathCached);
|
||||||
|
|
||||||
fs::path &path = pathCached[fNetSpecific ? 1 : 0];
|
fs::path &path = fNetSpecific ? pathCachedNetSpecific : pathCached;
|
||||||
|
|
||||||
// This can be called during exceptions by LogPrintf(), so we cache the
|
// This can be called during exceptions by LogPrintf(), so we cache the
|
||||||
// value so we don't have to do memory allocations after that.
|
// value so we don't have to do memory allocations after that.
|
||||||
@@ -430,7 +431,8 @@ const boost::filesystem::path &GetDataDir(bool fNetSpecific)
|
|||||||
|
|
||||||
void ClearDatadirCache()
|
void ClearDatadirCache()
|
||||||
{
|
{
|
||||||
std::fill(&pathCached[0], &pathCached[2], boost::filesystem::path());
|
pathCached = boost::filesystem::path();
|
||||||
|
pathCachedNetSpecific = boost::filesystem::path();
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::filesystem::path GetConfigFile()
|
boost::filesystem::path GetConfigFile()
|
||||||
|
|||||||
Reference in New Issue
Block a user