aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--contrib/epee/include/net/abstract_tcp_server2.inl14
-rw-r--r--contrib/epee/src/connection_basic.cpp2
-rw-r--r--src/rpc/bootstrap_daemon.cpp2
-rw-r--r--src/rpc/bootstrap_daemon.h2
-rw-r--r--src/wallet/wallet2.cpp6
-rw-r--r--tests/performance_tests/rct_mlsag.h2
6 files changed, 24 insertions, 4 deletions
diff --git a/contrib/epee/include/net/abstract_tcp_server2.inl b/contrib/epee/include/net/abstract_tcp_server2.inl
index 8d96e4a84..240ef3bc4 100644
--- a/contrib/epee/include/net/abstract_tcp_server2.inl
+++ b/contrib/epee/include/net/abstract_tcp_server2.inl
@@ -50,6 +50,8 @@
#include <sstream>
#include <iomanip>
#include <algorithm>
+#include <functional>
+#include <random>
#undef MONERO_DEFAULT_LOG_CATEGORY
#define MONERO_DEFAULT_LOG_CATEGORY "net"
@@ -628,7 +630,17 @@ PRAGMA_WARNING_DISABLE_VS(4355)
return false; // aborted
}*/
- long int ms = 250 + (rand()%50);
+ using engine = std::mt19937;
+
+ engine rng;
+ std::random_device dev;
+ std::seed_seq::result_type rand[engine::state_size]{}; // Use complete bit space
+
+ std::generate_n(rand, engine::state_size, std::ref(dev));
+ std::seed_seq seed(rand, rand + engine::state_size);
+ rng.seed(seed);
+
+ long int ms = 250 + (rng() % 50);
MDEBUG("Sleeping because QUEUE is FULL, in " << __FUNCTION__ << " for " << ms << " ms before packet_size="<<chunk.size()); // XXX debug sleep
m_send_que_lock.unlock();
boost::this_thread::sleep(boost::posix_time::milliseconds( ms ) );
diff --git a/contrib/epee/src/connection_basic.cpp b/contrib/epee/src/connection_basic.cpp
index 7526dde26..3ce7a1057 100644
--- a/contrib/epee/src/connection_basic.cpp
+++ b/contrib/epee/src/connection_basic.cpp
@@ -136,6 +136,7 @@ connection_basic::connection_basic(boost::asio::ip::tcp::socket&& sock, std::sha
socket_(GET_IO_SERVICE(sock), get_context(m_state.get())),
m_want_close_connection(false),
m_was_shutdown(false),
+ m_is_multithreaded(false),
m_ssl_support(ssl_support)
{
// add nullptr checks if removed
@@ -160,6 +161,7 @@ connection_basic::connection_basic(boost::asio::io_service &io_service, std::sha
socket_(io_service, get_context(m_state.get())),
m_want_close_connection(false),
m_was_shutdown(false),
+ m_is_multithreaded(false),
m_ssl_support(ssl_support)
{
// add nullptr checks if removed
diff --git a/src/rpc/bootstrap_daemon.cpp b/src/rpc/bootstrap_daemon.cpp
index 6f8426ee7..c97b2c95a 100644
--- a/src/rpc/bootstrap_daemon.cpp
+++ b/src/rpc/bootstrap_daemon.cpp
@@ -12,7 +12,7 @@
namespace cryptonote
{
- bootstrap_daemon::bootstrap_daemon(std::function<boost::optional<std::string>()> get_next_public_node) noexcept
+ bootstrap_daemon::bootstrap_daemon(std::function<boost::optional<std::string>()> get_next_public_node)
: m_get_next_public_node(get_next_public_node)
{
}
diff --git a/src/rpc/bootstrap_daemon.h b/src/rpc/bootstrap_daemon.h
index 130a6458d..6276b1b21 100644
--- a/src/rpc/bootstrap_daemon.h
+++ b/src/rpc/bootstrap_daemon.h
@@ -15,7 +15,7 @@ namespace cryptonote
class bootstrap_daemon
{
public:
- bootstrap_daemon(std::function<boost::optional<std::string>()> get_next_public_node) noexcept;
+ bootstrap_daemon(std::function<boost::optional<std::string>()> get_next_public_node);
bootstrap_daemon(const std::string &address, const boost::optional<epee::net_utils::http::login> &credentials);
std::string address() const noexcept;
diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp
index b85e805de..3e00369a8 100644
--- a/src/wallet/wallet2.cpp
+++ b/src/wallet/wallet2.cpp
@@ -13195,6 +13195,12 @@ bool wallet2::save_to_file(const std::string& path_to_file, const std::string& r
}
FILE *fp = fopen(path_to_file.c_str(), "w+");
+ if (!fp)
+ {
+ MERROR("Failed to open wallet file for writing: " << path_to_file << ": " << strerror(errno));
+ return false;
+ }
+
// Save the result b/c we need to close the fp before returning success/failure.
int write_result = PEM_write(fp, ASCII_OUTPUT_MAGIC.c_str(), "", (const unsigned char *) raw.c_str(), raw.length());
fclose(fp);
diff --git a/tests/performance_tests/rct_mlsag.h b/tests/performance_tests/rct_mlsag.h
index 59eae074e..da0c064fd 100644
--- a/tests/performance_tests/rct_mlsag.h
+++ b/tests/performance_tests/rct_mlsag.h
@@ -82,6 +82,6 @@ public:
private:
rct::keyV sk;
rct::keyM P;
- size_t ind;
+ size_t ind{};
rct::mgSig IIccss;
};