Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
net_plugin.cpp File Reference
#include <sysio/chain/types.hpp>
#include <sysio/net_plugin/net_plugin.hpp>
#include <sysio/net_plugin/protocol.hpp>
#include <sysio/chain/controller.hpp>
#include <sysio/chain/exceptions.hpp>
#include <sysio/chain/block.hpp>
#include <sysio/chain/plugin_interface.hpp>
#include <sysio/chain/thread_utils.hpp>
#include <sysio/producer_plugin/producer_plugin.hpp>
#include <sysio/chain/contract_types.hpp>
#include <fc/network/message_buffer.hpp>
#include <fc/network/ip.hpp>
#include <fc/io/json.hpp>
#include <fc/io/raw.hpp>
#include <fc/log/appender.hpp>
#include <fc/log/logger_config.hpp>
#include <fc/log/trace.hpp>
#include <fc/reflect/variant.hpp>
#include <fc/crypto/rand.hpp>
#include <fc/exception/exception.hpp>
#include <boost/asio/ip/tcp.hpp>
#include <boost/asio/ip/host_name.hpp>
#include <boost/asio/steady_timer.hpp>
#include <atomic>
#include <shared_mutex>
Include dependency graph for net_plugin.cpp:

Go to the source code of this file.

Classes

struct  sysio::node_transaction_state
 
struct  sysio::peer_block_state
 
class  sysio::sync_manager
 
class  sysio::dispatch_manager
 
class  sysio::net_plugin_impl
 
struct  sysio::peer_sync_state
 
class  sysio::queued_buffer
 
class  sysio::block_status_monitor
 
class  sysio::connection
 
struct  sysio::msg_handler
 
struct  sysio::buffer_factory
 
struct  sysio::block_buffer_factory
 
struct  sysio::trx_buffer_factory
 

Namespaces

namespace  sysio
 

Macros

#define peer_dlog(PEER, FORMAT, ...)
 
#define peer_ilog(PEER, FORMAT, ...)
 
#define peer_wlog(PEER, FORMAT, ...)
 
#define peer_elog(PEER, FORMAT, ...)
 

Typedefs

using sysio::connection_ptr = std::shared_ptr<connection>
 
using sysio::connection_wptr = std::weak_ptr<connection>
 
typedef multi_index_container< node_transaction_state, indexed_by< ordered_unique< tag< by_id >, composite_key< node_transaction_state, member< node_transaction_state, transaction_id_type, &node_transaction_state::id >, member< node_transaction_state, uint32_t, &node_transaction_state::connection_id > >, composite_key_compare< sha256_less, std::less< uint32_t > > >, ordered_non_unique< tag< by_expiry >, member< node_transaction_state, fc::time_point_sec, &node_transaction_state::expires > > > > sysio::node_transaction_index
 
typedef multi_index_container< sysio::peer_block_state, indexed_by< ordered_unique< tag< by_id >, composite_key< peer_block_state, member< peer_block_state, uint32_t, &sysio::peer_block_state::connection_id >, member< peer_block_state, block_id_type, &sysio::peer_block_state::id > >, composite_key_compare< std::less< uint32_t >, sha256_less > >, ordered_non_unique< tag< by_peer_block_id >, composite_key< peer_block_state, member< peer_block_state, block_id_type, &sysio::peer_block_state::id >, member< peer_block_state, bool, &sysio::peer_block_state::have_block > >, composite_key_compare< sha256_less, std::greater< bool > > >, ordered_non_unique< tag< by_block_num >, member< sysio::peer_block_state, uint32_t, &sysio::peer_block_state::block_num > > > > sysio::peer_block_state_index
 
using sysio::send_buffer_type = std::shared_ptr<std::vector<char>>
 

Functions

template<typename Strand >
void sysio::verify_strand_in_this_thread (const Strand &strand, const char *func, int line)
 
const fc::string sysio::logger_name ("net_plugin_impl")
 
template<class enum_type , class = typename std::enable_if<std::is_enum<enum_type>::value>::type>
enum_typesysio::operator|= (enum_type &lhs, const enum_type &rhs)
 
template<typename Function >
void sysio::for_each_connection (Function f)
 
template<typename Function >
void sysio::for_each_block_connection (Function f)
 
size_t sysio::calc_trx_size (const packed_transaction_ptr &trx)
 
template<typename T >
T sysio::dejsonify (const string &s)
 

Variables

constexpr auto sysio::def_send_buffer_size_mb = 4
 
constexpr auto sysio::def_send_buffer_size = 1024*1024*def_send_buffer_size_mb
 
constexpr auto sysio::def_max_write_queue_size = def_send_buffer_size*10
 
constexpr auto sysio::def_max_trx_in_progress_size = 100*1024*1024
 
constexpr auto sysio::def_max_consecutive_immediate_connection_close = 9
 
constexpr auto sysio::def_max_clients = 25
 
constexpr auto sysio::def_max_nodes_per_host = 1
 
constexpr auto sysio::def_conn_retry_wait = 30
 
constexpr auto sysio::def_txn_expire_wait = std::chrono::seconds(3)
 
constexpr auto sysio::def_resp_expected_wait = std::chrono::seconds(5)
 
constexpr auto sysio::def_sync_fetch_span = 100
 
constexpr auto sysio::def_keepalive_interval = 10000
 
constexpr auto sysio::message_header_size = sizeof(uint32_t)
 
constexpr uint32_t sysio::signed_block_which = fc::get_index<net_message, signed_block>()
 
constexpr uint32_t sysio::packed_transaction_which = fc::get_index<net_message, packed_transaction>()
 
fc::logger sysio::logger
 
std::string sysio::peer_log_format
 
constexpr uint16_t sysio::net_version_base = 0x04b5
 
constexpr uint16_t sysio::net_version_range = 106
 
constexpr uint16_t sysio::proto_base = 0
 
constexpr uint16_t sysio::proto_explicit_sync = 1
 
constexpr uint16_t sysio::proto_block_id_notify = 2
 
constexpr uint16_t sysio::proto_pruned_types = 3
 
constexpr uint16_t sysio::proto_heartbeat_interval = 4
 
constexpr uint16_t sysio::proto_dup_goaway_resolution = 5
 
constexpr uint16_t sysio::proto_dup_node_id_goaway = 6
 
constexpr uint16_t sysio::proto_wire_sysio_initial = 7
 
constexpr uint16_t sysio::net_version_max = proto_wire_sysio_initial
 

Macro Definition Documentation

◆ peer_dlog

#define peer_dlog ( PEER,
FORMAT,
... )
Value:
FC_MULTILINE_MACRO_BEGIN \
verify_strand_in_this_thread( PEER->strand, __func__, __LINE__ ); \
logger.log( FC_LOG_MESSAGE( debug, peer_log_format + FORMAT, __VA_ARGS__ (PEER->get_logger_variant()) ) ); \
} \
void log(log_message m)
Definition logger.cpp:62
bool is_enabled(log_level e) const
Definition logger.cpp:58
bool debug
#define FC_LOG_MESSAGE(LOG_LEVEL, FORMAT,...)
A helper method for generating log messages.
#define __func__
#define FC_MULTILINE_MACRO_END
Definition logger.hpp:74

Definition at line 359 of file net_plugin.cpp.

359#define peer_dlog( PEER, FORMAT, ... ) \
360 FC_MULTILINE_MACRO_BEGIN \
361 if( logger.is_enabled( fc::log_level::debug ) ) { \
362 verify_strand_in_this_thread( PEER->strand, __func__, __LINE__ ); \
363 logger.log( FC_LOG_MESSAGE( debug, peer_log_format + FORMAT, __VA_ARGS__ (PEER->get_logger_variant()) ) ); \
364 } \
365 FC_MULTILINE_MACRO_END

◆ peer_elog

#define peer_elog ( PEER,
FORMAT,
... )
Value:
FC_MULTILINE_MACRO_BEGIN \
verify_strand_in_this_thread( PEER->strand, __func__, __LINE__ ); \
logger.log( FC_LOG_MESSAGE( error, peer_log_format + FORMAT, __VA_ARGS__ (PEER->get_logger_variant()) ) ); \
} \

Definition at line 383 of file net_plugin.cpp.

383#define peer_elog( PEER, FORMAT, ... ) \
384 FC_MULTILINE_MACRO_BEGIN \
385 if( logger.is_enabled( fc::log_level::error ) ) { \
386 verify_strand_in_this_thread( PEER->strand, __func__, __LINE__ ); \
387 logger.log( FC_LOG_MESSAGE( error, peer_log_format + FORMAT, __VA_ARGS__ (PEER->get_logger_variant()) ) ); \
388 } \
389 FC_MULTILINE_MACRO_END

◆ peer_ilog

#define peer_ilog ( PEER,
FORMAT,
... )
Value:
FC_MULTILINE_MACRO_BEGIN \
verify_strand_in_this_thread( PEER->strand, __func__, __LINE__ ); \
logger.log( FC_LOG_MESSAGE( info, peer_log_format + FORMAT, __VA_ARGS__ (PEER->get_logger_variant()) ) ); \
} \

Definition at line 367 of file net_plugin.cpp.

367#define peer_ilog( PEER, FORMAT, ... ) \
368 FC_MULTILINE_MACRO_BEGIN \
369 if( logger.is_enabled( fc::log_level::info ) ) { \
370 verify_strand_in_this_thread( PEER->strand, __func__, __LINE__ ); \
371 logger.log( FC_LOG_MESSAGE( info, peer_log_format + FORMAT, __VA_ARGS__ (PEER->get_logger_variant()) ) ); \
372 } \
373 FC_MULTILINE_MACRO_END

◆ peer_wlog

#define peer_wlog ( PEER,
FORMAT,
... )
Value:
FC_MULTILINE_MACRO_BEGIN \
verify_strand_in_this_thread( PEER->strand, __func__, __LINE__ ); \
logger.log( FC_LOG_MESSAGE( warn, peer_log_format + FORMAT, __VA_ARGS__ (PEER->get_logger_variant()) ) ); \
} \

Definition at line 375 of file net_plugin.cpp.

375#define peer_wlog( PEER, FORMAT, ... ) \
376 FC_MULTILINE_MACRO_BEGIN \
377 if( logger.is_enabled( fc::log_level::warn ) ) { \
378 verify_strand_in_this_thread( PEER->strand, __func__, __LINE__ ); \
379 logger.log( FC_LOG_MESSAGE( warn, peer_log_format + FORMAT, __VA_ARGS__ (PEER->get_logger_variant()) ) ); \
380 } \
381 FC_MULTILINE_MACRO_END