34#include <boost/asio/post.hpp>
35#include <boost/foreach.hpp>
36#include <boost/uuid/random_generator.hpp>
37#include <boost/uuid/uuid_io.hpp>
38#include <boost/chrono.hpp>
39#include <boost/utility/value_init.hpp>
40#include <boost/asio/bind_executor.hpp>
41#include <boost/asio/deadline_timer.hpp>
42#include <boost/date_time/posix_time/posix_time.hpp>
43#include <boost/thread/condition_variable.hpp>
44#include <boost/make_shared.hpp>
45#include <boost/thread.hpp>
56#undef MONERO_DEFAULT_LOG_CATEGORY
57#define MONERO_DEFAULT_LOG_CATEGORY "net"
59#define AGGRESSIVE_TIMEOUT_THRESHOLD 120
60#define NEW_CONNECTION_TIMEOUT_LOCAL 1200000
61#define NEW_CONNECTION_TIMEOUT_REMOTE 10000
62#define DEFAULT_TIMEOUT_MS_LOCAL 1800000
63#define DEFAULT_TIMEOUT_MS_REMOTE 300000
64#define TIMEOUT_EXTRA_MS_PER_BYTE 0.2
74 CHECK_AND_ASSERT_THROW_MES(
bool(ptr),
"shared_state cannot be null");
84 static std::mutex hosts_mutex;
85 std::lock_guard<std::mutex> guard(hosts_mutex);
86 static std::map<std::string, unsigned int> hosts;
87 unsigned int &val = hosts[
m_host];
89 MTRACE(
"New connection from host " <<
m_host <<
": " << val);
91 MTRACE(
"Closed connection from host " <<
m_host <<
": " << val);
92 CHECK_AND_ASSERT_THROW_MES(delta >= 0 || val >= (
unsigned)-delta,
"Count would go negative");
93 CHECK_AND_ASSERT_THROW_MES(delta <= 0 || val <= std::numeric_limits<unsigned int>::max() - (
unsigned)delta,
"Count would wrap");
103 const unsigned shift = (
105 std::min(std::max(count, 1u) - 1, 8u) :
118 return std::chrono::duration_cast<connection<T>::duration_t>(
119 std::chrono::duration<double, std::chrono::milliseconds::period>(
147 if (
m_state.timers.general.wait_expire) {
148 m_state.timers.general.cancel_expire =
true;
149 m_state.timers.general.reset_expire =
true;
152 duration + (add ? (
m_timers.general.expiry() - std::chrono::steady_clock::now()) :
duration_t{}),
160 duration + (add ? (
m_timers.general.expiry() - std::chrono::steady_clock::now()) :
duration_t{}),
171 if (
m_state.timers.general.wait_expire)
173 m_state.timers.general.wait_expire =
true;
175 auto on_wait = [
this,
self] {
176 std::lock_guard<std::mutex> guard(
m_state.lock);
177 m_state.timers.general.wait_expire =
false;
178 if (
m_state.timers.general.cancel_expire) {
179 m_state.timers.general.cancel_expire =
false;
180 if (
m_state.timers.general.reset_expire) {
181 m_state.timers.general.reset_expire =
false;
195 boost::asio::post(
m_strand, on_wait);
202 if (!
m_state.timers.general.wait_expire)
204 m_state.timers.general.cancel_expire =
true;
205 m_state.timers.general.reset_expire =
false;
212 if (
m_state.socket.wait_handshake)
220 m_state.socket.wait_read =
true;
221 boost::asio::async_read(
224 m_state.data.read.buffer.data(),
225 m_state.data.read.buffer.size()
228 boost::asio::bind_executor(
230 [
this,
self](
const ec_t &ec,
size_t bytes_transferred){
231 std::lock_guard<std::mutex> guard(m_state.lock);
232 m_state.socket.wait_read = false;
233 if (m_state.socket.cancel_read) {
234 m_state.socket.cancel_read = false;
235 state_status_check();
237 else if (ec.value()) {
242 static_cast<const unsigned char *
>(
243 m_state.data.read.buffer.data()
248 m_state.ssl.enabled = false;
249 handle_read(bytes_transferred);
252 m_state.ssl.detected = true;
261 m_state.socket.wait_handshake =
true;
262 auto on_handshake = [
this, self](
const ec_t &ec,
size_t bytes_transferred){
263 std::lock_guard<std::mutex> guard(m_state.lock);
264 m_state.socket.wait_handshake =
false;
265 if (m_state.socket.cancel_handshake) {
266 m_state.socket.cancel_handshake =
false;
267 state_status_check();
269 else if (ec.value()) {
272 socket_t::shutdown_both,
276 m_state.socket.connected =
false;
280 m_state.ssl.handshaked =
true;
285 const auto handshake = handshake_t::server;
286 static_cast<shared_state&
>(
291 [
this, self, on_handshake]{
295 m_state.data.read.buffer.data(),
296 m_state.ssl.forced ? 0 :
299 boost::asio::bind_executor(m_strand, on_handshake)
308 if (
m_state.timers.throttle.in.wait_expire ||
m_state.socket.wait_read ||
315 auto calc_duration = []{
319 return std::chrono::duration_cast<connection<T>::duration_t>(
320 std::chrono::duration<double, std::chrono::seconds::period>(
323 ).get_sleep_time_after_tick(1),
329 const auto duration = calc_duration();
331 m_timers.throttle.in.expires_after(duration);
332 m_state.timers.throttle.in.wait_expire =
true;
333 auto on_wait = [
this,
self](
const ec_t &ec){
334 std::lock_guard<std::mutex> guard(
m_state.lock);
335 m_state.timers.throttle.in.wait_expire =
false;
336 if (
m_state.timers.throttle.in.cancel_expire) {
337 m_state.timers.throttle.in.cancel_expire =
false;
344 std::lock_guard<std::mutex> guard(
m_state.lock);
345 const bool error_status =
m_state.timers.throttle.in.cancel_expire || ec.value();
347 boost::asio::post(
m_strand, std::bind(on_wait, ec));
349 m_state.timers.throttle.in.wait_expire =
false;
356 m_state.socket.wait_read =
true;
357 auto on_read = [
this,
self](
const ec_t &ec,
size_t bytes_transferred){
358 std::lock_guard<std::mutex> guard(
m_state.lock);
359 m_state.socket.wait_read =
false;
360 if (
m_state.socket.cancel_read) {
362 state_status_check();
368 m_state.stat.in.throttle.handle_trafic_exact(bytes_transferred);
369 const auto speed =
m_state.stat.in.throttle.get_current_speed();
370 m_conn_context.m_current_speed_down =
speed;
371 m_conn_context.m_max_speed_down = std::max(
372 m_conn_context.m_max_speed_down,
375 if (speed_limit_is_enabled()) {
377 network_throttle_manager_t::m_lock_get_global_throttle_in
379 network_throttle_manager_t::get_global_throttle_in(
380 ).handle_trafic_exact(bytes_transferred);
383 m_conn_context.m_last_recv = time(NULL);
384 m_conn_context.m_recv_cnt += bytes_transferred;
385 start_timer(get_timeout_from_bytes_read(bytes_transferred),
true);
387 handle_read(bytes_transferred);
390 if (!m_state.ssl.enabled)
391 connection_basic::socket_.next_layer().async_read_some(
393 m_state.data.read.buffer.data(),
396 boost::asio::bind_executor(m_strand, on_read)
401 [
this, self, on_read]{
407 boost::asio::bind_executor(m_strand, on_read)
421 m_state.socket.handle_read =
true;
425 [
this,
self, bytes_transferred]{
429 reinterpret_cast<char *
>(
m_state.data.read.buffer.data()),
432 CATCH_ENTRY_SWALLOW_EX(
"m_handler.handle_recv");
433 std::lock_guard<std::mutex> guard(
m_state.lock);
438 m_state.socket.handle_read =
false;
446 std::lock_guard<std::mutex> guard(
m_state.lock);
447 m_state.socket.handle_read =
false;
454 if (
m_state.socket.wait_write) {
457 socket_t::shutdown_receive,
460 m_state.socket.shutdown_read =
true;
462 if (!
m_state.socket.wait_write || ec.value()) {
475 if (
m_state.timers.throttle.out.wait_expire ||
m_state.socket.wait_write ||
476 m_state.data.write.queue.empty() ||
483 auto calc_duration = [
this]{
487 return std::chrono::duration_cast<connection<T>::duration_t>(
488 std::chrono::duration<double, std::chrono::seconds::period>(
491 ).get_sleep_time_after_tick(
492 m_state.data.write.queue.back().size()
499 const auto duration = calc_duration();
500 if (duration > duration_t{}) {
501 m_timers.throttle.out.expires_after(duration);
502 m_state.timers.throttle.out.wait_expire =
true;
503 auto on_wait = [
this, self](
const ec_t &ec){
504 std::lock_guard<std::mutex> guard(
m_state.lock);
505 m_state.timers.throttle.out.wait_expire =
false;
506 if (
m_state.timers.throttle.out.cancel_expire) {
507 m_state.timers.throttle.out.cancel_expire =
false;
508 state_status_check();
513 m_timers.throttle.out.async_wait([
this, self, on_wait](
const ec_t &ec){
514 std::lock_guard<std::mutex> guard(m_state.lock);
515 const bool error_status = m_state.timers.throttle.out.cancel_expire || ec.value();
517 boost::asio::post(m_strand, std::bind(on_wait, ec));
519 m_state.timers.throttle.out.wait_expire =
false;
527 m_state.socket.wait_write =
true;
528 auto on_write = [
this, self](
const ec_t &ec,
size_t bytes_transferred){
529 std::lock_guard<std::mutex> guard(m_state.lock);
530 m_state.socket.wait_write =
false;
531 if (m_state.socket.cancel_write) {
532 m_state.socket.cancel_write =
false;
533 m_state.data.write.queue.clear();
534 m_state.data.write.total_bytes = 0;
535 state_status_check();
537 else if (ec.value()) {
538 m_state.data.write.queue.clear();
539 m_state.data.write.total_bytes = 0;
544 m_state.stat.out.throttle.handle_trafic_exact(bytes_transferred);
545 const auto speed = m_state.stat.out.throttle.get_current_speed();
546 m_conn_context.m_current_speed_up = speed;
547 m_conn_context.m_max_speed_down = std::max(
548 m_conn_context.m_max_speed_down,
551 if (speed_limit_is_enabled()) {
553 network_throttle_manager_t::m_lock_get_global_throttle_out
555 network_throttle_manager_t::get_global_throttle_out(
556 ).handle_trafic_exact(bytes_transferred);
558 connection_basic::logger_handle_net_write(bytes_transferred);
559 m_conn_context.m_last_send =
time(NULL);
560 m_conn_context.m_send_cnt += bytes_transferred;
562 start_timer(get_default_timeout(),
true);
564 const std::size_t byte_count = m_state.data.write.queue.back().size();
565 assert(bytes_transferred == byte_count);
566 m_state.data.write.queue.pop_back();
567 m_state.data.write.total_bytes -=
568 std::min(m_state.data.write.total_bytes, byte_count);
569 m_state.condition.notify_all();
570 if (m_state.data.write.queue.empty() && m_state.socket.shutdown_read) {
578 if (!m_state.ssl.enabled)
579 boost::asio::async_write(
580 connection_basic::socket_.next_layer(),
582 m_state.data.write.queue.back().data(),
583 m_state.data.write.queue.back().size()
585 boost::asio::bind_executor(m_strand, on_write)
590 [
this, self, on_write]{
591 boost::asio::async_write(
592 connection_basic::socket_,
594 m_state.data.write.queue.back().data(),
595 m_state.data.write.queue.back().size()
597 boost::asio::bind_executor(m_strand, on_write)
606 if (
m_state.socket.wait_shutdown)
609 m_state.socket.wait_shutdown =
true;
610 auto on_shutdown = [
this,
self](
const ec_t &ec){
611 std::lock_guard<std::mutex> guard(
m_state.lock);
612 m_state.socket.wait_shutdown =
false;
613 if (
m_state.socket.cancel_shutdown) {
614 m_state.socket.cancel_shutdown =
false;
636 [
this,
self, on_shutdown]{
638 boost::asio::bind_executor(
m_strand, on_shutdown)
648 bool wait_socket =
false;
649 if (
m_state.socket.wait_handshake)
650 wait_socket =
m_state.socket.cancel_handshake =
true;
651 if (
m_state.timers.throttle.in.wait_expire) {
652 m_state.timers.throttle.in.cancel_expire =
true;
656 wait_socket =
m_state.socket.cancel_read =
true;
657 if (
m_state.timers.throttle.out.wait_expire) {
658 m_state.timers.throttle.out.cancel_expire =
true;
662 wait_socket =
m_state.socket.cancel_write =
true;
663 if (
m_state.socket.wait_shutdown)
664 wait_socket =
m_state.socket.cancel_shutdown =
true;
676 m_state.protocol.wait_release =
true;
680 m_state.protocol.wait_release =
false;
681 m_state.protocol.released =
true;
697 m_state.condition.notify_all();
705 if (
m_state.timers.general.wait_expire)
707 if (
m_state.socket.wait_handshake)
709 if (
m_state.timers.throttle.in.wait_expire)
713 if (
m_state.socket.handle_read)
715 if (
m_state.timers.throttle.out.wait_expire)
720 if (
m_state.socket.wait_shutdown)
722 if (
m_state.protocol.wait_init)
724 if (
m_state.protocol.wait_callback)
726 if (
m_state.protocol.wait_release)
728 if (
m_state.socket.connected) {
732 socket_t::shutdown_both,
736 m_state.socket.connected =
false;
744 m_state.condition.notify_all();
758 m_state.condition.notify_all();
766 if (
m_state.timers.general.wait_expire)
768 if (
m_state.socket.wait_handshake)
770 if (
m_state.timers.throttle.in.wait_expire)
774 if (
m_state.socket.handle_read)
776 if (
m_state.timers.throttle.out.wait_expire)
785 if (
m_state.socket.wait_shutdown)
787 if (
m_state.protocol.wait_init)
789 if (
m_state.protocol.wait_callback)
791 if (
m_state.protocol.wait_release)
793 if (
m_state.socket.connected) {
796 socket_t::shutdown_both,
800 m_state.socket.connected =
false;
803 m_state.condition.notify_all();
812 std::lock_guard<std::mutex> guard(
m_state.lock);
820 std::lock_guard<std::mutex> guard(
m_state.lock);
823 if (std::numeric_limits<std::size_t>::max() -
m_state.data.write.total_bytes < message.size())
828 auto wait_consume = [
this] {
829 auto random_delay = []{
830 using engine = std::mt19937;
831 std::random_device dev;
832 std::seed_seq::result_type rand[
835 std::generate_n(rand, engine::state_size, std::ref(dev));
836 std::seed_seq
seed(rand, rand + engine::state_size);
838 return std::chrono::milliseconds(
839 std::uniform_int_distribution<>(5000, 6000)(rng)
851 m_state.data.write.wait_consume =
true;
859 m_state.data.write.queue.size() <=
861 m_state.data.write.total_bytes <=
867 m_state.data.write.wait_consume =
false;
875 auto wait_sender = [
this] {
880 m_state.status != status_t::RUNNING ||
881 !m_state.data.write.wait_consume
889 constexpr size_t CHUNK_SIZE = 32 * 1024;
891 message.size() <= 2 * CHUNK_SIZE
895 const std::size_t byte_count = message.size();
896 m_state.data.write.queue.emplace_front(std::move(message));
897 m_state.data.write.total_bytes += byte_count;
901 while (!message.empty()) {
904 m_state.data.write.queue.emplace_front(
905 message.take_slice(CHUNK_SIZE)
907 m_state.data.write.total_bytes +=
m_state.data.write.queue.front().size();
911 m_state.condition.notify_all();
918 bool is_multithreaded,
919 boost::optional<network_address> real_remote
922 std::unique_lock<std::mutex> guard(
m_state.lock);
933 endpoint.address().is_v6() ?
940 boost::asio::detail::socket_ops::host_to_network_long(
941 endpoint.address().to_v4().to_uint()
952 if (filter && !filter->is_remote_host_allowed(*real_remote))
958 if (is_income && limit && limit->is_host_limit(*real_remote))
962 #if !defined(_WIN32) || !defined(__i686)
964 boost::asio::detail::socket_option::integer<IPPROTO_IP, IP_TOS>{
973 boost::asio::ip::tcp::no_delay{
false},
980 boost::uuids::random_generator()(),
985 m_host = real_remote->host_str();
987 m_local = real_remote->is_loopback() || real_remote->is_local();
994 m_state.socket.connected =
true;
997 std::chrono::milliseconds(
1001 m_state.protocol.wait_init =
true;
1005 m_state.protocol.wait_init =
false;
1006 m_state.protocol.initialized =
true;
1011 else if (!is_income || !
m_state.ssl.enabled)
1018 template<
typename T>
1037 template<
typename T>
1056 template<
typename T>
1059 std::lock_guard<std::mutex> guard(
m_state.lock);
1069 template<
typename T>
1072 bool is_multithreaded
1078 template<
typename T>
1081 bool is_multithreaded,
1088 template<
typename T>
1091 std::lock_guard<std::mutex> guard(
m_state.lock);
1098 port =
"<not connected>";
1101 address = endpoint.address().to_string();
1102 port = std::to_string(endpoint.port());
1109 " (via " <<
address <<
":" << port <<
")"
1113 template<
typename T>
1119 template<
typename T>
1122 return close(
false);
1125 template<
typename T>
1128 return send(std::move(message));
1131 template<
typename T>
1137 template<
typename T>
1140 std::lock_guard<std::mutex> guard(
m_state.lock);
1148 if (!wait_for_shutdown)
1155 MDEBUG(
"Waiting for connection " <<
m_conn_context.m_connection_id <<
" to shutdown, current state: " <<
m_state.status);
1156 const bool shutdown =
m_state.condition.wait_for(
1158 std::chrono::seconds(5),
1161 m_state.status == status_t::TERMINATED || m_state.status == status_t::WASTED
1166 MDEBUG(
"Shut down connection " <<
m_conn_context.m_connection_id);
1168 MERROR(
"Connection " <<
m_conn_context.m_connection_id <<
" did not shut down");
1173 template<
typename T>
1187 template<
typename T>
1190 std::lock_guard<std::mutex> guard(
m_state.lock);
1194 ++
m_state.protocol.wait_callback;
1198 CATCH_ENTRY_SWALLOW_EX(
"m_handler.handle_qued_callback");
1199 std::lock_guard<std::mutex> guard(
m_state.lock);
1200 --
m_state.protocol.wait_callback;
1209 template<
typename T>
1215 template<
typename T>
1220 std::lock_guard<std::mutex> guard(
m_state.lock);
1222 ++
m_state.protocol.reference_counter;
1225 catch (boost::bad_weak_ptr &exception) {
1230 template<
typename T>
1234 std::lock_guard<std::mutex> guard(
m_state.lock);
1235 if (!(--
m_state.protocol.reference_counter))
1236 self = std::move(this->self);
1240 template<
typename T>
1243 std::lock_guard<std::mutex> guard(
m_state.lock);
1247 template<
class t_protocol_handler>
1266 template<
class t_protocol_handler>
1284 template<
class t_protocol_handler>
1291 template<
class t_protocol_handler>
1299 template<
class t_protocol_handler>
1301 uint32_t port_ipv6,
const std::string& address_ipv6,
bool use_ipv6,
bool require_ipv4,
1314 m_state->configure_ssl(std::move(ssl_options));
1316 std::string ipv4_failed =
"";
1317 std::string ipv6_failed =
"";
1319 boost::asio::ip::tcp::resolver resolver(
io_context_);
1323 const auto results = resolver.resolve(
1324 address, boost::lexical_cast<std::string>(port), boost::asio::ip::tcp::resolver::canonical_name
1326 acceptor_.open(results.begin()->endpoint().protocol());
1328 acceptor_.set_option(boost::asio::ip::tcp::acceptor::reuse_address(
true));
1332 boost::asio::ip::tcp::endpoint binded_endpoint =
acceptor_.local_endpoint();
1333 m_port = binded_endpoint.port();
1334 MDEBUG(
"start accept (IPv4)");
1338 boost::asio::placeholders::error));
1340 catch (
const std::exception &e)
1342 ipv4_failed = e.what();
1345 if (ipv4_failed !=
"")
1347 MERROR(
"Failed to bind IPv4: " << ipv4_failed);
1350 throw std::runtime_error(
"Failed to bind IPv4 (set to required)");
1358 if (port_ipv6 == 0) port_ipv6 = port;
1360 const auto results = resolver.resolve(
1361 address_ipv6, boost::lexical_cast<std::string>(port_ipv6), boost::asio::ip::tcp::resolver::canonical_name
1366 acceptor_ipv6.set_option(boost::asio::ip::tcp::acceptor::reuse_address(
true));
1371 boost::asio::ip::tcp::endpoint binded_endpoint =
acceptor_ipv6.local_endpoint();
1373 MDEBUG(
"start accept (IPv6)");
1377 boost::asio::placeholders::error));
1379 catch (
const std::exception &e)
1381 ipv6_failed = e.what();
1385 if (use_ipv6 && ipv6_failed !=
"")
1387 MERROR(
"Failed to bind IPv6: " << ipv6_failed);
1388 if (ipv4_failed !=
"")
1390 throw std::runtime_error(
"Failed to bind IPv4 and IPv6");
1396 catch (
const std::exception &e)
1398 MFATAL(
"Error starting server: " << e.what());
1403 MFATAL(
"Error starting server");
1408 template<
class t_protocol_handler>
1410 const std::string port_ipv6,
const std::string address_ipv6,
bool use_ipv6,
bool require_ipv4,
1417 MERROR(
"Failed to convert port no = " << port);
1422 MERROR(
"Failed to convert port no = " << port_ipv6);
1425 return this->
init_server(p,
address, p_ipv6, address_ipv6, use_ipv6, require_ipv4, std::move(ssl_options));
1428 template<
class t_protocol_handler>
1434 thread_name += boost::to_string(local_thr_index) +
"]";
1435 MLOG_SET_THREAD_NAME(thread_name);
1444 catch(
const std::exception& ex)
1446 _erro(
"Exception at server worker thread, what=" << ex.what());
1450 _erro(
"Exception at server worker thread, unknown execption");
1455 CATCH_ENTRY_L0(
"boosted_tcp_server<t_protocol_handler>::worker_thread",
false);
1458 template<
class t_protocol_handler>
1463 if (it==
server_type_map.end())
throw std::runtime_error(
"Unknown prefix/server type:" + std::string(prefix_name));
1464 auto connection_type = it->second;
1465 MINFO(
"Set server type to: " << connection_type <<
" from name: " <<
m_thread_name_prefix <<
", prefix_name = " << prefix_name);
1468 template<
class t_protocol_handler>
1475 template<
class t_protocol_handler>
1482 template<
class t_protocol_handler>
1486 m_state->response_soft_limit = limit;
1489 template<
class t_protocol_handler>
1495 MLOG_SET_THREAD_NAME(
"[SRV_MAIN]");
1501 for (std::size_t i = 0; i < threads_count; ++i)
1503 boost::shared_ptr<boost::thread> thread(
new boost::thread(
1512 _fact(
"JOINING all threads");
1513 for (std::size_t i = 0; i <
m_threads.size(); ++i) {
1516 _fact(
"JOINING all threads - almost");
1518 _fact(
"JOINING all threads - DONE");
1522 _dbg1(
"Reiniting OK.");
1529 _dbg1(
"Net service stopped without stop request, restarting...");
1532 _dbg1(
"Reiniting service failed, exit.");
1536 _dbg1(
"Reiniting OK.");
1541 CATCH_ENTRY_L0(
"boosted_tcp_server<t_protocol_handler>::run_server",
false);
1544 template<
class t_protocol_handler>
1549 BOOST_FOREACH(boost::shared_ptr<boost::thread>& thp,
m_threads)
1551 if(thp->get_id() == boost::this_thread::get_id())
1557 CATCH_ENTRY_L0(
"boosted_tcp_server<t_protocol_handler>::is_thread_worker",
false);
1560 template<
class t_protocol_handler>
1564 boost::chrono::milliseconds ms(wait_mseconds);
1565 for (std::size_t i = 0; i <
m_threads.size(); ++i)
1569 _dbg1(
"Interrupting thread " <<
m_threads[i]->native_handle());
1574 CATCH_ENTRY_L0(
"boosted_tcp_server<t_protocol_handler>::timed_wait_server_stop",
false);
1577 template<
class t_protocol_handler>
1582 state->stop_signal_sent =
true;
1595 close_all_connections();
1597 MDEBUG(
"Done with send_stop_signal");
1598 CATCH_ENTRY_L0(
"boosted_tcp_server<t_protocol_handler>::send_stop_signal()",
void());
1601 template<
class t_protocol_handler>
1607 template<
class t_protocol_handler>
1613 template<
class t_protocol_handler>
1616 MDEBUG(
"handle_accept");
1618 boost::asio::ip::tcp::acceptor* current_acceptor = &
acceptor_;
1628 bool accept_started =
false;
1634 const char *ssl_message =
"unknown";
1635 switch ((*current_new_connection)->get_ssl_support())
1641 MDEBUG(
"New server for RPC connections, SSL " << ssl_message);
1642 (*current_new_connection)->setRpcStation();
1646 current_acceptor->async_accept((*current_new_connection)->socket(),
1647 boost::bind(accept_function_pointer,
this,
1648 boost::asio::placeholders::error));
1649 accept_started =
true;
1651 boost::asio::socket_base::keep_alive opt(
true);
1652 conn->socket().set_option(opt);
1664 conn->save_dbg_log();
1669 MERROR(
"Error in boosted_tcp_server<t_protocol_handler>::handle_accept: " << e);
1672 catch (
const std::exception &e)
1674 MERROR(
"Exception in boosted_tcp_server<t_protocol_handler>::handle_accept: " << e.what());
1681 _erro(
"Some problems at accept: " << e.message() <<
", connections_count = " <<
m_state->sock_count);
1684 current_acceptor->async_accept((*current_new_connection)->socket(),
1685 boost::bind(accept_function_pointer,
this,
1686 boost::asio::placeholders::error));
1689 template<
class t_protocol_handler>
1692 if(std::addressof(
get_io_context()) == std::addressof(sock.get_executor().context()))
1697 conn->get_context(out);
1698 conn->save_dbg_log();
1704 MWARNING(out <<
" was not added, socket/io_context mismatch");
1709 template<
class t_protocol_handler>
1714 sock_.open(remote_endpoint.protocol());
1715 if(bind_ip !=
"0.0.0.0" && bind_ip !=
"0" && bind_ip !=
"" )
1717 boost::asio::ip::tcp::endpoint local_endpoint(boost::asio::ip::make_address(bind_ip), 0);
1718 boost::system::error_code ec;
1719 sock_.bind(local_endpoint, ec);
1722 MERROR(
"Error binding to " << bind_ip <<
": " << ec.message());
1723 if (sock_.is_open())
1733 boost::system::error_code ec = boost::asio::error::would_block;
1736 struct local_async_context
1738 boost::system::error_code ec;
1739 boost::mutex connect_mut;
1740 boost::condition_variable cond;
1743 boost::shared_ptr<local_async_context> local_shared_context(
new local_async_context());
1744 local_shared_context->ec = boost::asio::error::would_block;
1745 boost::unique_lock<boost::mutex> lock(local_shared_context->connect_mut);
1746 auto connect_callback = [](boost::system::error_code ec_, boost::shared_ptr<local_async_context> shared_context)
1748 shared_context->connect_mut.lock(); shared_context->ec = ec_; shared_context->cond.notify_one(); shared_context->connect_mut.unlock();
1751 sock_.async_connect(remote_endpoint, std::bind<void>(connect_callback, std::placeholders::_1, local_shared_context));
1752 while(local_shared_context->ec == boost::asio::error::would_block)
1754 bool r = local_shared_context->cond.timed_wait(lock, boost::get_system_time() + boost::posix_time::milliseconds(conn_timeout));
1757 if (sock_.is_open())
1761 if(local_shared_context->ec == boost::asio::error::would_block && !r)
1765 _dbg3(
"Failed to connect to " << adr <<
":" << port <<
", because of timeout (" << conn_timeout <<
")");
1769 ec = local_shared_context->ec;
1771 if (ec || !sock_.is_open())
1773 _dbg3(
"Some problems at connect, message: " << ec.message());
1774 if (sock_.is_open())
1779 _dbg3(
"Connected success to " << adr <<
':' << port);
1781 const ssl_support_t ssl_support = new_connection_l->get_ssl_support();
1785 MDEBUG(
"Handshaking SSL...");
1786 if (!new_connection_l->handshake(boost::asio::ssl::stream_base::client))
1790 boost::system::error_code ignored_ec;
1791 sock_.shutdown(boost::asio::ip::tcp::socket::shutdown_both, ignored_ec);
1795 MERROR(
"SSL handshake failed");
1796 if (sock_.is_open())
1804 CATCH_ENTRY_L0(
"boosted_tcp_server<t_protocol_handler>::try_connect",
CONNECT_FAILURE);
1807 template<
class t_protocol_handler>
1815 MDEBUG(
"connections_ size now " <<
connections_.size());
1818 boost::asio::ip::tcp::socket& sock_ = new_connection_l->socket();
1820 bool try_ipv6 =
false;
1822 boost::asio::ip::tcp::resolver resolver(
io_context_);
1823 boost::asio::ip::tcp::resolver::results_type results{};
1824 boost::system::error_code resolve_error;
1829 results = resolver.resolve(
1830 boost::asio::ip::tcp::v4(), adr, port, boost::asio::ip::tcp::resolver::canonical_name, resolve_error
1833 catch (
const boost::system::system_error& e)
1835 if (!
m_use_ipv6 || (resolve_error != boost::asio::error::host_not_found &&
1836 resolve_error != boost::asio::error::host_not_found_try_again))
1847 std::string bind_ip_to_use;
1853 _erro(
"Failed to resolve " << adr);
1859 MINFO(
"Resolving address as IPv4 failed, trying IPv6");
1864 bind_ip_to_use = bind_ip;
1869 results = resolver.resolve(
1870 boost::asio::ip::tcp::v6(), adr, port, boost::asio::ip::tcp::resolver::canonical_name, resolve_error
1875 _erro(
"Failed to resolve " << adr);
1880 if (bind_ip ==
"0.0.0.0")
1882 bind_ip_to_use =
"::";
1886 bind_ip_to_use =
"";
1893 const auto iterator = results.begin();
1895 MDEBUG(
"Trying to connect to " << adr <<
":" << port <<
", bind_ip = " << bind_ip_to_use);
1898 boost::asio::ip::tcp::endpoint remote_endpoint(*iterator);
1900 auto try_connect_result =
try_connect(new_connection_l, adr, port, sock_, remote_endpoint, bind_ip_to_use, conn_timeout, ssl_support);
1906 MERROR(
"SSL handshake failed on an autodetect connection, reconnecting without SSL");
1907 new_connection_l->disable_ssl();
1920 new_connection_l->get_context(conn_context);
1925 _erro(
"[sock " << new_connection_l->socket().native_handle() <<
"] Failed to start connection, connections_count = " <<
m_state->sock_count);
1928 new_connection_l->save_dbg_log();
1932 CATCH_ENTRY_L0(
"boosted_tcp_server<t_protocol_handler>::connect",
false);
1935 template<
class t_protocol_handler>
template<
class t_callback>
1942 MDEBUG(
"connections_ size now " <<
connections_.size());
1945 boost::asio::ip::tcp::socket& sock_ = new_connection_l->socket();
1947 bool try_ipv6 =
false;
1949 boost::asio::ip::tcp::resolver resolver(
io_context_);
1950 boost::asio::ip::tcp::resolver::results_type results{};
1951 boost::system::error_code resolve_error;
1956 results = resolver.resolve(
1957 boost::asio::ip::tcp::v4(), adr, port, boost::asio::ip::tcp::resolver::canonical_name, resolve_error
1960 catch (
const boost::system::system_error& e)
1962 if (!
m_use_ipv6 || (resolve_error != boost::asio::error::host_not_found &&
1963 resolve_error != boost::asio::error::host_not_found_try_again))
1978 _erro(
"Failed to resolve " << adr);
1983 MINFO(
"Resolving address as IPv4 failed, trying IPv6");
1989 results = resolver.resolve(
1990 boost::asio::ip::tcp::v6(), adr, port, boost::asio::ip::tcp::resolver::canonical_name, resolve_error
1995 _erro(
"Failed to resolve " << adr);
2000 boost::asio::ip::tcp::endpoint remote_endpoint(*results.begin());
2002 sock_.open(remote_endpoint.protocol());
2003 if(bind_ip !=
"0.0.0.0" && bind_ip !=
"0" && bind_ip !=
"" )
2005 boost::asio::ip::tcp::endpoint local_endpoint(boost::asio::ip::make_address(bind_ip.c_str()), 0);
2006 boost::system::error_code ec;
2007 sock_.bind(local_endpoint, ec);
2010 MERROR(
"Error binding to " << bind_ip <<
": " << ec.message());
2011 if (sock_.is_open())
2017 boost::shared_ptr<boost::asio::deadline_timer> sh_deadline(
new boost::asio::deadline_timer(
io_context_));
2019 sh_deadline->expires_from_now(boost::posix_time::milliseconds(conn_timeout));
2020 sh_deadline->async_wait([=](
const boost::system::error_code& error)
2022 if(error != boost::asio::error::operation_aborted)
2024 _dbg3(
"Failed to connect to " << adr <<
':' << port <<
", because of timeout (" << conn_timeout <<
")");
2025 new_connection_l->socket().close();
2029 sock_.async_connect(remote_endpoint, [=](
const boost::system::error_code& ec_)
2032 boost::system::error_code ignored_ec;
2033 boost::asio::ip::tcp::socket::endpoint_type lep = new_connection_l->socket().local_endpoint(ignored_ec);
2036 if(!sh_deadline->cancel())
2038 cb(conn_context, boost::asio::error::operation_aborted);
2041 _dbg3(
"[sock " << new_connection_l->socket().native_handle() <<
"] Connected success to " << adr <<
':' << port <<
2042 " from " << lep.address().to_string() <<
':' << lep.port());
2051 new_connection_l->get_context(conn_context);
2052 cb(conn_context, ec_);
2056 _dbg3(
"[sock " << new_connection_l->socket().native_handle() <<
"] Failed to start connection to " << adr <<
':' << port);
2057 cb(conn_context, boost::asio::error::fault);
2062 _dbg3(
"[sock " << new_connection_l->socket().native_handle() <<
"] Failed to connect to " << adr <<
':' << port <<
2063 " from " << lep.address().to_string() <<
':' << lep.port() <<
": " << ec_.message() <<
':' << ec_.value());
2064 cb(conn_context, ec_);
2068 CATCH_ENTRY_L0(
"boosted_tcp_server<t_protocol_handler>::connect_async",
false);
#define ABSTRACT_SERVER_SEND_QUE_MAX_COUNT
Definition abstract_tcp_server2.h:67
#define NEW_CONNECTION_TIMEOUT_LOCAL
Definition abstract_tcp_server2.inl:60
#define NEW_CONNECTION_TIMEOUT_REMOTE
Definition abstract_tcp_server2.inl:61
#define TIMEOUT_EXTRA_MS_PER_BYTE
Definition abstract_tcp_server2.inl:64
#define AGGRESSIVE_TIMEOUT_THRESHOLD
Definition abstract_tcp_server2.inl:59
#define DEFAULT_TIMEOUT_MS_LOCAL
Definition abstract_tcp_server2.inl:62
#define DEFAULT_TIMEOUT_MS_REMOTE
Definition abstract_tcp_server2.inl:63
static void close()
Definition blockchain_blackball.cpp:279
Definition byte_slice.h:69
boost::asio::ip::tcp::acceptor acceptor_ipv6
Definition abstract_tcp_server2.h:522
boost::shared_ptr< connection< t_protocol_handler > > connection_ptr
Definition abstract_tcp_server2.h:356
uint32_t m_port
Definition abstract_tcp_server2.h:526
size_t m_threads_count
Definition abstract_tcp_server2.h:533
void set_connection_limit(i_connection_limit *plimit)
Definition abstract_tcp_server2.inl:1476
void handle_accept_ipv6(const boost::system::error_code &e)
Definition abstract_tcp_server2.inl:1608
bool m_require_ipv4
Definition abstract_tcp_server2.h:531
std::map< std::string, t_connection_type > server_type_map
Definition abstract_tcp_server2.h:365
std::vector< boost::shared_ptr< boost::thread > > m_threads
Definition abstract_tcp_server2.h:534
boost::asio::ip::tcp::acceptor acceptor_
Acceptor used to listen for incoming connections.
Definition abstract_tcp_server2.h:521
try_connect_result_t
Definition abstract_tcp_server2.h:349
@ CONNECT_FAILURE
Definition abstract_tcp_server2.h:351
@ CONNECT_NO_SSL
Definition abstract_tcp_server2.h:352
@ CONNECT_SUCCESS
Definition abstract_tcp_server2.h:350
std::atomic< bool > m_stop_signal_sent
Definition abstract_tcp_server2.h:525
~boosted_tcp_server()
Definition abstract_tcp_server2.inl:1285
bool connect(const std::string &adr, const std::string &port, uint32_t conn_timeot, t_connection_context &cn, const std::string &bind_ip="0.0.0.0", epee::net_utils::ssl_support_t ssl_support=epee::net_utils::ssl_support_t::e_ssl_support_autodetect)
Definition abstract_tcp_server2.inl:1808
bool timed_wait_server_stop(uint64_t wait_mseconds)
wait for service workers stop
Definition abstract_tcp_server2.inl:1561
connection_ptr new_connection_
The next connection to be accepted.
Definition abstract_tcp_server2.h:542
boost::asio::io_context & get_io_context()
Definition abstract_tcp_server2.h:437
t_protocol_handler::connection_context t_connection_context
Definition abstract_tcp_server2.h:357
boosted_tcp_server(t_connection_type connection_type)
Definition abstract_tcp_server2.inl:1248
void send_stop_signal(std::function< void()> close_all_connections=[](){})
Stop the server.
Definition abstract_tcp_server2.inl:1578
try_connect_result_t try_connect(connection_ptr new_connection_l, const std::string &adr, const std::string &port, boost::asio::ip::tcp::socket &sock_, const boost::asio::ip::tcp::endpoint &remote_endpoint, const std::string &bind_ip, uint32_t conn_timeout, epee::net_utils::ssl_support_t ssl_support)
Definition abstract_tcp_server2.inl:1710
boost::mutex connections_mutex
Definition abstract_tcp_server2.h:546
void handle_accept_ipv4(const boost::system::error_code &e)
Handle completion of an asynchronous accept operation.
Definition abstract_tcp_server2.inl:1602
connection_ptr new_connection_ipv6
Definition abstract_tcp_server2.h:543
bool worker_thread()
Run the server's io_context loop.
Definition abstract_tcp_server2.inl:1429
void create_server_type_map()
Definition abstract_tcp_server2.inl:1292
bool add_connection(t_connection_context &out, boost::asio::ip::tcp::socket &&sock, network_address real_remote, epee::net_utils::ssl_support_t ssl_support=epee::net_utils::ssl_support_t::e_ssl_support_autodetect)
Definition abstract_tcp_server2.inl:1690
std::string m_address_ipv6
Definition abstract_tcp_server2.h:529
critical_section m_threads_lock
Definition abstract_tcp_server2.h:536
void set_connection_filter(i_connection_filter *pfilter)
Definition abstract_tcp_server2.inl:1469
t_connection_type m_connection_type
Definition abstract_tcp_server2.h:539
std::string m_address
Definition abstract_tcp_server2.h:528
std::string m_thread_name_prefix
Definition abstract_tcp_server2.h:532
epee::net_utils::network_address default_remote
Definition abstract_tcp_server2.h:523
bool run_server(size_t threads_count, bool wait=true, const boost::thread::attributes &attrs=boost::thread::attributes())
Run the server's io_context loop.
Definition abstract_tcp_server2.inl:1490
void handle_accept(const boost::system::error_code &e, bool ipv6=false)
Definition abstract_tcp_server2.inl:1614
bool connect_async(const std::string &adr, const std::string &port, uint32_t conn_timeot, const t_callback &cb, const std::string &bind_ip="0.0.0.0", epee::net_utils::ssl_support_t ssl_support=epee::net_utils::ssl_support_t::e_ssl_support_autodetect, t_connection_context &&initial=t_connection_context{})
void set_threads_prefix(const std::string &prefix_name)
Definition abstract_tcp_server2.inl:1459
bool init_server(uint32_t port, const std::string &address="0.0.0.0", uint32_t port_ipv6=0, const std::string &address_ipv6="::", bool use_ipv6=false, bool require_ipv4=true, ssl_options_t ssl_options=ssl_support_t::e_ssl_support_autodetect)
Definition abstract_tcp_server2.inl:1300
boost::asio::io_context & io_context_
Definition abstract_tcp_server2.h:518
std::unique_ptr< worker > m_io_context_local_instance
Definition abstract_tcp_server2.h:517
uint32_t m_port_ipv6
Definition abstract_tcp_server2.h:527
void set_response_soft_limit(std::size_t limit)
Definition abstract_tcp_server2.inl:1483
bool m_use_ipv6
Definition abstract_tcp_server2.h:530
boost::thread::id m_main_thread_id
Definition abstract_tcp_server2.h:535
std::set< connection_ptr > connections_
Definition abstract_tcp_server2.h:547
bool is_thread_worker()
Definition abstract_tcp_server2.inl:1545
const std::shared_ptr< typename connection< epee::net_utils::http::http_custom_handler< epee::net_utils::connection_context_base > >::shared_state > m_state
Definition abstract_tcp_server2.h:505
std::atomic< uint32_t > m_thread_index
Definition abstract_tcp_server2.h:537
std::atomic< long > sock_count
Definition connection_basic.hpp:67
boost::asio::ssl::stream< boost::asio::ip::tcp::socket > socket_
Socket for the connection.
Definition connection_basic.hpp:117
static int get_tos_flag()
Definition connection_basic.cpp:226
boost::asio::io_context::strand strand_
Strand to ensure the connection's handlers are not called concurrently.
Definition connection_basic.hpp:115
void logger_handle_net_read(size_t size)
Definition connection_basic.cpp:270
boost::asio::ip::tcp::socket & socket()
Definition connection_basic.hpp:130
ssl_support_t m_ssl_support
Definition connection_basic.hpp:118
connection_basic_shared_state & get_state() noexcept
Definition connection_basic.hpp:128
volatile bool m_is_multithreaded
Definition connection_basic.hpp:113
connection_basic(boost::asio::io_context &context, boost::asio::ip::tcp::socket &&sock, std::shared_ptr< connection_basic_shared_state > state, ssl_support_t ssl_support)
Definition connection_basic.cpp:124
Represents a single connection from a client.
Definition abstract_tcp_server2.h:100
void setRpcStation()
Definition abstract_tcp_server2.inl:1241
virtual bool call_run_once_service_io()
Definition abstract_tcp_server2.inl:1174
boost::asio::ip::tcp::socket socket_t
Definition abstract_tcp_server2.h:114
io_context_t & m_io_context
Definition abstract_tcp_server2.h:262
void terminate()
Definition abstract_tcp_server2.inl:748
virtual bool send_done()
Definition abstract_tcp_server2.inl:1132
void start_timer(duration_t duration, bool add={})
Definition abstract_tcp_server2.inl:145
t_protocol_handler::connection_context t_connection_context
Definition abstract_tcp_server2.h:102
void cancel_handler()
Definition abstract_tcp_server2.inl:672
boost::asio::io_context io_context_t
Definition abstract_tcp_server2.h:112
void async_wait_timer()
Definition abstract_tcp_server2.inl:169
bool m_local
Definition abstract_tcp_server2.h:268
void start_write()
Definition abstract_tcp_server2.inl:473
t_protocol_handler m_handler
Definition abstract_tcp_server2.h:271
void start_read()
Definition abstract_tcp_server2.inl:306
void interrupt()
Definition abstract_tcp_server2.inl:689
connection(io_context_t &io_context, std::shared_ptr< shared_state > state, t_connection_type connection_type, epee::net_utils::ssl_support_t ssl_support, t_connection_context &&initial=t_connection_context{})
Construct a connection with the given io_context.
Definition abstract_tcp_server2.inl:1019
void on_terminating()
Definition abstract_tcp_server2.inl:763
virtual bool do_send(byte_slice message)
(see do_send from i_service_endpoint)
Definition abstract_tcp_server2.inl:1126
bool send(epee::byte_slice message)
Definition abstract_tcp_server2.inl:818
virtual bool release()
Definition abstract_tcp_server2.inl:1231
virtual bool request_callback()
Definition abstract_tcp_server2.inl:1188
bool speed_limit_is_enabled() const
tells us should we be sleeping here (e.g. do not sleep on RPC connections)
Definition abstract_tcp_server2.inl:1114
boost::shared_ptr< connection_t > connection_ptr
Definition abstract_tcp_server2.h:105
void on_interrupted()
Definition abstract_tcp_server2.inl:702
std::string m_host
Definition abstract_tcp_server2.h:269
void start_handshake()
Definition abstract_tcp_server2.inl:210
virtual io_context_t & get_io_context()
Definition abstract_tcp_server2.inl:1210
timers_t m_timers
Definition abstract_tcp_server2.h:266
bool start_internal(bool is_income, bool is_multithreaded, boost::optional< network_address > real_remote)
Definition abstract_tcp_server2.inl:916
@ RUNNING
Definition abstract_tcp_server2.h:154
@ INTERRUPTED
Definition abstract_tcp_server2.h:155
@ TERMINATING
Definition abstract_tcp_server2.h:156
@ WASTED
Definition abstract_tcp_server2.h:157
@ TERMINATED
Definition abstract_tcp_server2.h:153
void terminate_async()
Definition abstract_tcp_server2.inl:807
duration_t get_timeout_from_bytes_read(size_t bytes) const
Definition abstract_tcp_server2.inl:116
virtual ~connection() noexcept(false)
Definition abstract_tcp_server2.inl:1057
void cancel_timer()
Definition abstract_tcp_server2.inl:200
void handle_read(size_t bytes_transferred)
Definition abstract_tcp_server2.inl:414
void state_status_check()
Definition abstract_tcp_server2.inl:126
state_t m_state
Definition abstract_tcp_server2.h:270
strand_t m_strand
Definition abstract_tcp_server2.h:265
void start_shutdown()
Definition abstract_tcp_server2.inl:604
epee::net_utils::ssl_support_t ssl_support_t
Definition abstract_tcp_server2.h:106
void cancel_socket()
Definition abstract_tcp_server2.inl:646
t_connection_context m_conn_context
Definition abstract_tcp_server2.h:264
virtual bool close(const bool wait_for_shutdown)
Definition abstract_tcp_server2.inl:1138
void save_dbg_log()
Definition abstract_tcp_server2.inl:1089
virtual bool add_ref()
Definition abstract_tcp_server2.inl:1216
unsigned int host_count(int delta=0)
Definition abstract_tcp_server2.inl:82
bool start(bool is_income, bool is_multithreaded)
Start the first asynchronous operation for the connection.
Definition abstract_tcp_server2.inl:1070
timer_t::duration duration_t
Definition abstract_tcp_server2.h:108
bool cancel()
Definition abstract_tcp_server2.inl:1120
t_connection_type m_connection_type
Definition abstract_tcp_server2.h:263
connection_ptr self
Definition abstract_tcp_server2.h:267
duration_t get_default_timeout()
Definition abstract_tcp_server2.inl:99
boost::system::error_code ec_t
Definition abstract_tcp_server2.h:109
Definition net_utils_base.h:69
Definition net_utils_base.h:172
Definition net_utils_base.h:225
static boost::mutex m_lock_get_global_throttle_in
Definition network_throttle.hpp:107
static i_network_throttle & get_global_throttle_in()
singleton ; for friend class ; caller MUST use proper locks! like m_lock_get_global_throttle_in
Definition network_throttle.cpp:76
static i_network_throttle & get_global_throttle_out()
ditto ; use lock ... use m_lock_get_global_throttle_out obviously
Definition network_throttle.cpp:89
static boost::mutex m_lock_get_global_throttle_out
Definition network_throttle.hpp:109
const uint8_t seed[32]
Definition code-generator.cpp:37
bool success
Definition cold-transaction.cpp:57
std::unique_ptr< test_connection > conn(new test_connection(io_service, m_handler_config))
const char * res
Definition hmac_keccak.cpp:42
#define AUTO_VAL_INIT(v)
Definition misc_language.h:36
boost::shared_ptr< call_befor_die_base > auto_scope_leave_caller
Definition misc_language.h:80
bool sleep_no_w(long ms)
Definition misc_language.cpp:35
auto_scope_leave_caller create_scope_leave_handler(t_scope_leave_handler f)
Definition misc_language.h:97
T & check_and_get(std::shared_ptr< T > &ptr)
Definition abstract_tcp_server2.inl:72
@ ipv6
Definition enums.h:44
@ invalid
Definition enums.h:42
std::string to_string(t_connection_type type)
Definition connection_basic.cpp:70
bool is_ssl(const unsigned char *data, size_t len)
Definition net_ssl.cpp:424
constexpr size_t get_ssl_magic_size()
Definition net_ssl.h:150
t_connection_type
Definition connection_basic.hpp:93
@ e_connection_type_NET
Definition connection_basic.hpp:94
@ e_connection_type_RPC
Definition connection_basic.hpp:95
@ e_connection_type_P2P
Definition connection_basic.hpp:96
ssl_support_t
Definition net_ssl.h:49
@ e_ssl_support_disabled
Definition net_ssl.h:50
@ e_ssl_support_autodetect
Definition net_ssl.h:52
@ e_ssl_support_enabled
Definition net_ssl.h:51
TODO: (mj-xmr) This will be reduced in an another PR.
Definition byte_slice.h:40
int time
Definition gen_wide_data.py:40
if(!cryptonote::get_account_address_from_str_or_url(info, cryptonote::TESTNET, "9uVsvEryzpN8WH2t1WWhFFCG5tS8cBNdmJYNRuckLENFimfauV5pZKeS1P2CbxGkSDTUPHXWwiYE5ZGSXDAGbaZgDxobqDN"))
Definition signature.cpp:53
static cryptonote::account_public_address address
Definition signature.cpp:38
unsigned int uint32_t
Definition stdint.h:126
unsigned __int64 uint64_t
Definition stdint.h:136
The io_context used to perform asynchronous operations.
Definition abstract_tcp_server2.h:509
Definition abstract_tcp_server2.h:274
std::size_t response_soft_limit
Definition abstract_tcp_server2.h:286
Definition abstract_tcp_server2.h:76
Definition abstract_tcp_server2.h:83
#define CRITICAL_REGION_LOCAL(x)
Definition syncobj.h:153
#define CRITICAL_REGION_END()
Definition syncobj.h:158
#define CRITICAL_REGION_BEGIN(x)
Definition syncobj.h:154