Remove NetworkService::config() (#8653)
This commit is contained in:
committed by
Marek Kotewicz
parent
485d4aa8f3
commit
dab967ace8
@@ -212,13 +212,14 @@ impl<C, M, U, S> Parity for ParityClient<C, M, U> where
|
||||
|
||||
fn net_peers(&self) -> Result<Peers> {
|
||||
let sync_status = self.sync.status();
|
||||
let net_config = self.net.network_config();
|
||||
let num_peers_range = self.net.num_peers_range();
|
||||
debug_assert!(num_peers_range.end > num_peers_range.start);
|
||||
let peers = self.sync.peers().into_iter().map(Into::into).collect();
|
||||
|
||||
Ok(Peers {
|
||||
active: sync_status.num_active_peers,
|
||||
connected: sync_status.num_peers,
|
||||
max: sync_status.current_max_peers(net_config.min_peers, net_config.max_peers),
|
||||
max: sync_status.current_max_peers(num_peers_range.start, num_peers_range.end - 1),
|
||||
peers: peers
|
||||
})
|
||||
}
|
||||
|
||||
@@ -14,7 +14,8 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
use sync::{ManageNetwork, NetworkConfiguration};
|
||||
use std::ops::Range;
|
||||
use sync::ManageNetwork;
|
||||
use self::ethcore_network::{ProtocolId, NetworkContext};
|
||||
|
||||
extern crate ethcore_network;
|
||||
@@ -29,6 +30,6 @@ impl ManageNetwork for TestManageNetwork {
|
||||
fn add_reserved_peer(&self, _peer: String) -> Result<(), String> { Ok(()) }
|
||||
fn start_network(&self) {}
|
||||
fn stop_network(&self) {}
|
||||
fn network_config(&self) -> NetworkConfiguration { NetworkConfiguration::new_local() }
|
||||
fn num_peers_range(&self) -> Range<u32> { 25 .. 51 }
|
||||
fn with_proto_context(&self, _: ProtocolId, _: &mut FnMut(&NetworkContext)) { }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user