mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 03:52:49 +01:00
trivial: misc. trivial refactoring (#4104)
* minor statsd refactoring * stacktrace refactoring * spork typos + unused include * need thread on windows builds
This commit is contained in:
parent
01dd958429
commit
91f4e71563
@ -11,7 +11,6 @@
|
||||
#include <key.h>
|
||||
|
||||
#include <unordered_map>
|
||||
#include <unordered_set>
|
||||
|
||||
class CSporkMessage;
|
||||
class CSporkManager;
|
||||
@ -192,7 +191,7 @@ public:
|
||||
READWRITE(strVersion);
|
||||
}
|
||||
// we don't serialize pubkey ids because pubkeys should be
|
||||
// hardcoded or be setted with cmdline or options, should
|
||||
// hardcoded or be set with cmdline or options, should
|
||||
// not reuse pubkeys from previous dashd run
|
||||
LOCK(cs);
|
||||
READWRITE(mapSporksByHash);
|
||||
@ -284,7 +283,7 @@ public:
|
||||
* a spork to be considered active.
|
||||
*
|
||||
* This value must be at least a majority of the total number of spork
|
||||
* keys, and for obvious resons cannot be larger than that number.
|
||||
* keys, and for obvious reasons cannot be larger than that number.
|
||||
*/
|
||||
bool SetMinSporkKeys(int minSporkKeys);
|
||||
|
||||
|
@ -9,7 +9,6 @@
|
||||
#include <stacktraces.h>
|
||||
#include <fs.h>
|
||||
#include <logging.h>
|
||||
#include <random.h>
|
||||
#include <streams.h>
|
||||
#include <utilstrencodings.h>
|
||||
|
||||
@ -17,18 +16,18 @@
|
||||
#include <map>
|
||||
#include <vector>
|
||||
#include <memory>
|
||||
#include <thread>
|
||||
#include <atomic>
|
||||
|
||||
#if WIN32
|
||||
#include <windows.h>
|
||||
#include <dbghelp.h>
|
||||
#include <thread>
|
||||
#else
|
||||
#ifdef ENABLE_STACKTRACES
|
||||
#include <execinfo.h>
|
||||
#endif
|
||||
#include <unistd.h>
|
||||
#include <signal.h>
|
||||
#include <csignal>
|
||||
#endif
|
||||
|
||||
#if !WIN32
|
||||
@ -49,7 +48,7 @@
|
||||
#include <backtrace.h>
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
#include <cstring>
|
||||
|
||||
std::string DemangleSymbol(const std::string& name)
|
||||
{
|
||||
@ -356,8 +355,8 @@ static std::vector<stackframe_info> GetStackFrameInfos(const std::vector<uint64_
|
||||
std::vector<stackframe_info> infos;
|
||||
infos.reserve(stackframes.size());
|
||||
|
||||
for (size_t i = 0; i < stackframes.size(); i++) {
|
||||
if (backtrace_pcinfo(GetLibBacktraceState(), stackframes[i], my_backtrace_full_callback, my_backtrace_error_callback, &infos)) {
|
||||
for (uint64_t stackframe : stackframes) {
|
||||
if (backtrace_pcinfo(GetLibBacktraceState(), stackframe, my_backtrace_full_callback, my_backtrace_error_callback, &infos)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -499,9 +498,7 @@ static std::string GetCrashInfoStr(const crash_info& ci, size_t spaces)
|
||||
std::vector<std::string> lstrs;
|
||||
lstrs.reserve(ci.stackframeInfos.size());
|
||||
|
||||
for (size_t i = 0; i < ci.stackframeInfos.size(); i++) {
|
||||
auto& si = ci.stackframeInfos[i];
|
||||
|
||||
for (const auto& si : ci.stackframeInfos) {
|
||||
std::string lstr;
|
||||
if (!si.filename.empty()) {
|
||||
lstr += fs::path(si.filename).filename().string();
|
||||
|
@ -11,8 +11,6 @@
|
||||
|
||||
#include <cxxabi.h>
|
||||
|
||||
#include <tinyformat.h>
|
||||
|
||||
std::string DemangleSymbol(const std::string& name);
|
||||
|
||||
std::string GetPrettyExceptionStr(const std::exception_ptr& e);
|
||||
|
@ -35,10 +35,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#include <random.h>
|
||||
#include <util.h>
|
||||
|
||||
#include <math.h>
|
||||
#include <time.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <cmath>
|
||||
#include <cstdio>
|
||||
|
||||
statsd::StatsdClient statsClient;
|
||||
|
||||
@ -88,7 +86,7 @@ StatsdClient::~StatsdClient()
|
||||
// close socket
|
||||
CloseSocket(d->sock);
|
||||
delete d;
|
||||
d = NULL;
|
||||
d = nullptr;
|
||||
}
|
||||
|
||||
void StatsdClient::config(const std::string& host, int port, const std::string& ns)
|
||||
|
@ -53,13 +53,13 @@ class StatsdClient {
|
||||
|
||||
protected:
|
||||
int init();
|
||||
void cleanup(std::string& key);
|
||||
static void cleanup(std::string& key);
|
||||
|
||||
protected:
|
||||
struct _StatsdClientData* d;
|
||||
};
|
||||
|
||||
}; // namespace statsd
|
||||
} // namespace statsd
|
||||
|
||||
extern statsd::StatsdClient statsClient;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user