mirror of
https://github.com/monero-project/monero.git
synced 2024-10-01 11:49:47 -04:00
Merge pull request #4571
c3b8328c
daemon: do not run complex code in a signal handler (moneromooo-monero)e736964a
Remove epee header dependency on cryptonote_core (moneromooo-monero)
This commit is contained in:
commit
f916ef81f1
@ -43,6 +43,8 @@
|
||||
#include <boost/date_time/posix_time/posix_time.hpp> // TODO
|
||||
#include <boost/thread/thread.hpp> // TODO
|
||||
#include <boost/thread/condition_variable.hpp> // TODO
|
||||
#include "warnings.h"
|
||||
#include "string_tools.h"
|
||||
#include "misc_language.h"
|
||||
#include "net/local_ip.h"
|
||||
#include "pragma_comp_defs.h"
|
||||
@ -51,8 +53,6 @@
|
||||
#include <iomanip>
|
||||
#include <algorithm>
|
||||
|
||||
#include "../../../../src/cryptonote_core/cryptonote_core.h" // e.g. for the send_stop_signal()
|
||||
|
||||
#undef MONERO_DEFAULT_LOG_CATEGORY
|
||||
#define MONERO_DEFAULT_LOG_CATEGORY "net"
|
||||
|
||||
@ -149,10 +149,8 @@ PRAGMA_WARNING_DISABLE_VS(4355)
|
||||
const unsigned long ip_{boost::asio::detail::socket_ops::host_to_network_long(remote_ep.address().to_v4().to_ulong())};
|
||||
m_local = epee::net_utils::is_ip_loopback(ip_) || epee::net_utils::is_ip_local(ip_);
|
||||
|
||||
// create a random uuid
|
||||
boost::uuids::uuid random_uuid;
|
||||
// that stuff turns out to be included, even though it's from src... Taking advantage
|
||||
random_uuid = crypto::rand<boost::uuids::uuid>();
|
||||
// create a random uuid, we don't need crypto strength here
|
||||
const boost::uuids::uuid random_uuid = boost::uuids::random_generator()();
|
||||
|
||||
context.set_details(random_uuid, epee::net_utils::ipv4_network_address(ip_, remote_ep.port()), is_income);
|
||||
_dbg3("[sock " << socket_.native_handle() << "] new connection from " << print_connection_context_short(context) <<
|
||||
|
@ -32,6 +32,7 @@
|
||||
#include "string_tools.h"
|
||||
#include "file_io_utils.h"
|
||||
#include "net_parse_helpers.h"
|
||||
#include "time_helper.h"
|
||||
|
||||
#undef MONERO_DEFAULT_LOG_CATEGORY
|
||||
#define MONERO_DEFAULT_LOG_CATEGORY "net.http"
|
||||
|
@ -136,7 +136,14 @@ bool t_daemon::run(bool interactive)
|
||||
{
|
||||
throw std::runtime_error{"Can't run stopped daemon"};
|
||||
}
|
||||
tools::signal_handler::install(std::bind(&daemonize::t_daemon::stop_p2p, this));
|
||||
|
||||
std::atomic<bool> stop(false);
|
||||
boost::thread([&stop, this] {
|
||||
while (!stop)
|
||||
epee::misc_utils::sleep_no_w(100);
|
||||
this->stop_p2p();
|
||||
}).detach();
|
||||
tools::signal_handler::install([&stop](int){ stop = true; });
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -29,6 +29,7 @@
|
||||
#include <map>
|
||||
#include "cryptonote_basic/cryptonote_basic.h"
|
||||
#include "cryptonote_basic/tx_extra.h"
|
||||
#include "cryptonote_core/cryptonote_core.h"
|
||||
#include "cryptonote_core/blockchain.h"
|
||||
#include "p2p/p2p_protocol_defs.h"
|
||||
#include "net/connection_basic.hpp"
|
||||
|
@ -29,6 +29,7 @@
|
||||
// Parts of this file are originally copyright (c) 2012-2013 The Cryptonote developers
|
||||
|
||||
#include "common/command_line.h"
|
||||
#include "cryptonote_core/cryptonote_core.h"
|
||||
#include "net_node.h"
|
||||
|
||||
namespace nodetool
|
||||
|
@ -35,6 +35,7 @@
|
||||
#include <string>
|
||||
#include "common/util.h"
|
||||
#include "net/http_server_impl_base.h"
|
||||
#include "math_helper.h"
|
||||
#include "wallet_rpc_server_commands_defs.h"
|
||||
#include "wallet2.h"
|
||||
|
||||
|
@ -41,6 +41,7 @@
|
||||
#include "misc_language.h"
|
||||
#include "misc_log_ex.h"
|
||||
#include "storages/levin_abstract_invoke2.h"
|
||||
#include "common/util.h"
|
||||
|
||||
#include "net_load_tests.h"
|
||||
|
||||
|
@ -34,6 +34,7 @@
|
||||
#include "include_base_utils.h"
|
||||
#include "misc_log_ex.h"
|
||||
#include "storages/levin_abstract_invoke2.h"
|
||||
#include "common/util.h"
|
||||
|
||||
#include "net_load_tests.h"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user