Skip to content

Commit 554136b

Browse files
authored
Merge pull request #1230 from AntelopeIO/net_plugin_cleanup
Minor fixes to remove unneeded static variable reference.
2 parents 1bf5078 + e507008 commit 554136b

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

plugins/net_plugin/net_plugin.cpp

+12-12
Original file line numberDiff line numberDiff line change
@@ -4082,19 +4082,19 @@ namespace eosio {
40824082
fc_dlog(logger, "on_accepted_block_header ${bn} ${id}", ("bn", block->block_num())("id", id));
40834083
update_chain_info();
40844084

4085-
boost::asio::post( my_impl->thread_pool.get_executor(), [block, id]() {
4085+
boost::asio::post( thread_pool.get_executor(), [block, id, this]() {
40864086
fc_dlog(logger, "signaled accepted_block_header, blk num = ${num}, id = ${id}", ("num", block->block_num())("id", id));
4087-
my_impl->dispatcher.bcast_block(block, id);
4087+
dispatcher.bcast_block(block, id);
40884088
});
40894089
}
40904090

40914091
void net_plugin_impl::on_accepted_block( const signed_block_ptr& block, const block_id_type& id) {
40924092
fc_dlog(logger, "on_accepted_block ${bn} ${id}", ("bn", block->block_num())("id", id));
40934093
update_chain_info();
40944094

4095-
if (my_impl->chain_plug->chain().get_read_mode() != db_read_mode::IRREVERSIBLE) {
4095+
if (chain_plug->chain().get_read_mode() != db_read_mode::IRREVERSIBLE) {
40964096
// irreversible notifies sync_manager when added to fork_db, non-irreversible notifies when applied
4097-
my_impl->dispatcher.strand.post([sync_master = my_impl->sync_master.get(), block, id]() {
4097+
dispatcher.strand.post([sync_master = sync_master.get(), block, id]() {
40984098
const fc::microseconds age(fc::time_point::now() - block->timestamp);
40994099
sync_master->sync_recv_block(connection_ptr{}, id, block->block_num(), age);
41004100
});
@@ -4112,9 +4112,9 @@ namespace eosio {
41124112
fc_dlog( logger, "on_irreversible_block, blk num = ${num}, id = ${id}", ("num", block->block_num())("id", id) );
41134113
update_chain_info(id);
41144114

4115-
if (my_impl->chain_plug->chain().get_read_mode() == db_read_mode::IRREVERSIBLE) {
4115+
if (chain_plug->chain().get_read_mode() == db_read_mode::IRREVERSIBLE) {
41164116
// irreversible notifies sync_manager when added to fork_db, non-irreversible notifies when applied
4117-
my_impl->dispatcher.strand.post([sync_master = my_impl->sync_master.get(), block, id]() {
4117+
dispatcher.strand.post([sync_master = sync_master.get(), block, id]() {
41184118
const fc::microseconds age(fc::time_point::now() - block->timestamp);
41194119
sync_master->sync_recv_block(connection_ptr{}, id, block->block_num(), age);
41204120
});
@@ -4147,7 +4147,7 @@ namespace eosio {
41474147
case vote_result_t::invalid_signature:
41484148
case vote_result_t::max_exceeded: // close peer immediately
41494149
fc_elog(vote_logger, "Invalid vote(s), closing connection - ${c}", ("c", connection_id));
4150-
my_impl->connections.any_of_connections([connection_id](const connection_ptr& c) {
4150+
connections.any_of_connections([connection_id](const connection_ptr& c) {
41514151
if (c->connection_id == connection_id) {
41524152
c->close( false );
41534153
return true;
@@ -4158,7 +4158,7 @@ namespace eosio {
41584158
case vote_result_t::unknown_block: // track the failure
41594159
fc_dlog(vote_logger, "connection - ${c} vote unknown block #${bn}:${id}..",
41604160
("c", connection_id)("bn", block_header::num_from_id(msg->block_id))("id", msg->block_id.str().substr(8,16)));
4161-
my_impl->connections.any_of_connections([connection_id](const connection_ptr& c) {
4161+
connections.any_of_connections([connection_id](const connection_ptr& c) {
41624162
if (c->connection_id == connection_id) {
41634163
boost::asio::post(c->strand, [c]() {
41644164
c->block_status_monitor_.rejected();
@@ -4176,24 +4176,24 @@ namespace eosio {
41764176
}
41774177

41784178
void net_plugin_impl::bcast_vote_message( uint32_t exclude_peer, const chain::vote_message_ptr& msg ) {
4179-
if (my_impl->sync_master->syncing_from_peer())
4179+
if (sync_master->syncing_from_peer())
41804180
return;
41814181

41824182
fc_dlog(vote_logger, "bcast ${t} vote: block #${bn} ${id}.., ${v}, key ${k}..",
41834183
("t", exclude_peer ? "received" : "our")("bn", block_header::num_from_id(msg->block_id))("id", msg->block_id.str().substr(8,16))
41844184
("v", msg->strong ? "strong" : "weak")("k", msg->finalizer_key.to_string().substr(8,16)));
41854185

4186-
boost::asio::post( my_impl->thread_pool.get_executor(), [exclude_peer, msg]() mutable {
4186+
boost::asio::post( thread_pool.get_executor(), [exclude_peer, msg, this]() mutable {
41874187
buffer_factory buff_factory;
41884188
auto send_buffer = buff_factory.get_send_buffer( *msg );
41894189

4190-
my_impl->dispatcher.bcast_vote_msg( exclude_peer, std::move(send_buffer) );
4190+
dispatcher.bcast_vote_msg( exclude_peer, std::move(send_buffer) );
41914191
});
41924192
}
41934193

41944194
// called from application thread
41954195
void net_plugin_impl::transaction_ack(const std::pair<fc::exception_ptr, packed_transaction_ptr>& results) {
4196-
boost::asio::post( my_impl->thread_pool.get_executor(), [&dispatcher = my_impl->dispatcher, results]() {
4196+
boost::asio::post( thread_pool.get_executor(), [this, results]() {
41974197
const auto& id = results.second->id();
41984198
if (results.first) {
41994199
fc_dlog( logger, "signaled NACK, trx-id = ${id} : ${why}", ("id", id)( "why", results.first->to_detail_string() ) );

0 commit comments

Comments
 (0)