Skip to content

Commit

Permalink
Merge pull request EOSIO#932 from EOSIO/STAT-284-gh-931
Browse files Browse the repository at this point in the history
(reapplied to noon branch)
  • Loading branch information
Aspian123 authored and spoonincode committed Dec 12, 2017
1 parent 2a905aa commit 893d6b2
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion plugins/net_plugin/net_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1066,6 +1066,9 @@ namespace eosio {

bool connection::process_next_message(net_plugin_impl& impl, uint32_t message_length) {
try {
if (response_expected) {
response_expected->cancel();
}
// If it is a signed_block, then save the raw message for the cache
// This must be done before we unpack the message.
// This code is copied from fc::io::unpack(..., unsigned_int)
Expand Down Expand Up @@ -1122,7 +1125,8 @@ namespace eosio {

bool sync_manager::syncing( ) {
fc_dlog(logger, "ours = ${ours} known = ${known} head = ${head}",("ours",sync_last_requested_num)("known",sync_known_lib_num)("head",chain_plug->chain( ).head_block_num( )));
return( sync_last_requested_num != sync_known_lib_num ||

return( sync_last_requested_num < sync_known_lib_num ||
chain_plug->chain( ).head_block_num( ) < sync_last_requested_num );
}

Expand Down Expand Up @@ -1330,6 +1334,16 @@ namespace eosio {
auto socket = std::make_shared<tcp::socket>( std::ref( app().get_io_service() ) );
acceptor->async_accept( *socket, [socket,this]( boost::system::error_code ec ) {
if( !ec ) {
int visitors = 0;
for (auto &conn : connections) {
if(conn->current() && conn->peer_addr.empty()) {
visitors++;
}
}
if (num_clients != visitors) {
ilog ("checking max client, visitors = ${v} num clients ${n}",("v",visitors)("n",num_clients));
num_clients = visitors;
}
if( max_client_count == 0 || num_clients < max_client_count ) {
++num_clients;
connection_ptr c = std::make_shared<connection>( socket );
Expand Down

0 comments on commit 893d6b2

Please sign in to comment.