Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

Init net_plugin member variables - 1.8 #8616

Merged
merged 1 commit into from
Feb 12, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 15 additions & 15 deletions plugins/net_plugin/include/eosio/net_plugin/protocol.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ namespace eosio {
chain_id_type chain_id; ///< used to identify chain
fc::sha256 node_id; ///< used to identify peers and prevent self-connect
chain::public_key_type key; ///< authentication key; may be a producer or peer key, or empty
tstamp time;
tstamp time{0};
fc::sha256 token; ///< digest of time to prove we own the private key of the key above
chain::signature_type sig; ///< signature for the digest
string p2p_address;
Expand All @@ -43,7 +43,7 @@ namespace eosio {
block_id_type head_id;
string os;
string agent;
int16_t generation;
int16_t generation{0};
};


Expand Down Expand Up @@ -81,16 +81,16 @@ namespace eosio {
}

struct go_away_message {
go_away_message (go_away_reason r = no_reason) : reason(r), node_id() {}
go_away_reason reason;
go_away_message(go_away_reason r = no_reason) : reason(r), node_id() {}
go_away_reason reason{no_reason};
fc::sha256 node_id; ///< for duplicate notification
};

struct time_message {
tstamp org; //!< origin timestamp
tstamp rec; //!< receive timestamp
tstamp xmt; //!< transmit timestamp
mutable tstamp dst; //!< destination timestamp
tstamp org{0}; //!< origin timestamp
tstamp rec{0}; //!< receive timestamp
tstamp xmt{0}; //!< transmit timestamp
mutable tstamp dst{0}; //!< destination timestamp
};

enum id_list_modes {
Expand All @@ -112,9 +112,9 @@ namespace eosio {

template<typename T>
struct select_ids {
select_ids () : mode(none),pending(0),ids() {}
id_list_modes mode;
uint32_t pending;
select_ids() : mode(none),pending(0),ids() {}
id_list_modes mode{none};
uint32_t pending{0};
vector<T> ids;
bool empty () const { return (mode == none || ids.empty()); }
};
Expand All @@ -123,20 +123,20 @@ namespace eosio {
using ordered_blk_ids = select_ids<block_id_type>;

struct notice_message {
notice_message () : known_trx(), known_blocks() {}
notice_message() : known_trx(), known_blocks() {}
ordered_txn_ids known_trx;
ordered_blk_ids known_blocks;
};

struct request_message {
request_message () : req_trx(), req_blocks() {}
request_message() : req_trx(), req_blocks() {}
ordered_txn_ids req_trx;
ordered_blk_ids req_blocks;
};

struct sync_request_message {
uint32_t start_block;
uint32_t end_block;
uint32_t start_block{0};
uint32_t end_block{0};
};

using net_message = static_variant<handshake_message,
Expand Down
28 changes: 14 additions & 14 deletions plugins/net_plugin/net_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,9 @@ namespace eosio {
unique_ptr<boost::asio::steady_timer> connector_check;
unique_ptr<boost::asio::steady_timer> transaction_check;
unique_ptr<boost::asio::steady_timer> keepalive_timer;
boost::asio::steady_timer::duration connector_period;
boost::asio::steady_timer::duration txn_exp_period;
boost::asio::steady_timer::duration resp_expected_period;
boost::asio::steady_timer::duration connector_period{0};
boost::asio::steady_timer::duration txn_exp_period{0};
boost::asio::steady_timer::duration resp_expected_period{0};
boost::asio::steady_timer::duration keepalive_interval{std::chrono::seconds{32}};
int max_cleanup_time_ms = 0;

Expand Down Expand Up @@ -349,7 +349,7 @@ namespace eosio {
*/
struct peer_block_state {
block_id_type id;
uint32_t block_num;
uint32_t block_num{0};
};

typedef multi_index_container<
Expand All @@ -362,7 +362,7 @@ namespace eosio {


struct update_block_num {
uint32_t new_bnum;
uint32_t new_bnum{0};
update_block_num(uint32_t bnum) : new_bnum(bnum) {}
void operator() (node_transaction_state& nts) {
nts.block_num = new_bnum;
Expand All @@ -380,9 +380,9 @@ namespace eosio {
:start_block( start ), end_block( end ), last( last_acted ),
start_time(time_point::now())
{}
uint32_t start_block;
uint32_t end_block;
uint32_t last; ///< last sent or received
uint32_t start_block{0};
uint32_t end_block{0};
uint32_t last{0}; ///< last sent or received
time_point start_time; ///< time request made or received
};

Expand Down Expand Up @@ -530,7 +530,7 @@ namespace eosio {
double offset{0}; //!< peer offset

static const size_t ts_buffer_size{32};
char ts[ts_buffer_size]; //!< working buffer for making human readable timestamps
char ts[ts_buffer_size]{}; //!< working buffer for making human readable timestamps
/** @} */

bool connected();
Expand Down Expand Up @@ -661,12 +661,12 @@ namespace eosio {
in_sync
};

uint32_t sync_known_lib_num;
uint32_t sync_last_requested_num;
uint32_t sync_next_expected_num;
uint32_t sync_req_span;
uint32_t sync_known_lib_num{0};
uint32_t sync_last_requested_num{0};
uint32_t sync_next_expected_num{0};
uint32_t sync_req_span{0};
connection_ptr source;
stages state;
stages state{in_sync};

chain_plugin* chain_plug = nullptr;

Expand Down