Fix warnings: dyn
This commit is contained in:
@@ -287,19 +287,19 @@ pub struct Host {
|
||||
sessions: Arc<RwLock<Slab<SharedSession>>>,
|
||||
discovery: Mutex<Option<Discovery<'static>>>,
|
||||
nodes: RwLock<NodeTable>,
|
||||
handlers: RwLock<HashMap<ProtocolId, Arc<NetworkProtocolHandler + Sync>>>,
|
||||
handlers: RwLock<HashMap<ProtocolId, Arc<dyn NetworkProtocolHandler + Sync>>>,
|
||||
timers: RwLock<HashMap<TimerToken, ProtocolTimer>>,
|
||||
timer_counter: RwLock<usize>,
|
||||
reserved_nodes: RwLock<HashSet<NodeId>>,
|
||||
stopping: AtomicBool,
|
||||
filter: Option<Arc<ConnectionFilter>>,
|
||||
filter: Option<Arc<dyn ConnectionFilter>>,
|
||||
}
|
||||
|
||||
impl Host {
|
||||
/// Create a new instance
|
||||
pub fn new(
|
||||
mut config: NetworkConfiguration,
|
||||
filter: Option<Arc<ConnectionFilter>>,
|
||||
filter: Option<Arc<dyn ConnectionFilter>>,
|
||||
) -> Result<Host, Error> {
|
||||
let mut listen_address = match config.listen_address {
|
||||
None => SocketAddr::V4(SocketAddrV4::new(Ipv4Addr::new(0, 0, 0, 0), DEFAULT_PORT)),
|
||||
@@ -1130,7 +1130,7 @@ impl Host {
|
||||
|
||||
pub fn with_context<F>(&self, protocol: ProtocolId, io: &IoContext<NetworkIoMessage>, action: F)
|
||||
where
|
||||
F: FnOnce(&NetworkContextTrait),
|
||||
F: FnOnce(&dyn NetworkContextTrait),
|
||||
{
|
||||
let reserved = { self.reserved_nodes.read() };
|
||||
|
||||
@@ -1145,7 +1145,7 @@ impl Host {
|
||||
action: F,
|
||||
) -> T
|
||||
where
|
||||
F: FnOnce(&NetworkContextTrait) -> T,
|
||||
F: FnOnce(&dyn NetworkContextTrait) -> T,
|
||||
{
|
||||
let reserved = { self.reserved_nodes.read() };
|
||||
|
||||
|
||||
@@ -48,14 +48,14 @@ pub struct NetworkService {
|
||||
host: RwLock<Option<Arc<Host>>>,
|
||||
host_handler: Arc<HostHandler>,
|
||||
config: NetworkConfiguration,
|
||||
filter: Option<Arc<ConnectionFilter>>,
|
||||
filter: Option<Arc<dyn ConnectionFilter>>,
|
||||
}
|
||||
|
||||
impl NetworkService {
|
||||
/// Starts IO event loop
|
||||
pub fn new(
|
||||
config: NetworkConfiguration,
|
||||
filter: Option<Arc<ConnectionFilter>>,
|
||||
filter: Option<Arc<dyn ConnectionFilter>>,
|
||||
) -> Result<NetworkService, Error> {
|
||||
let host_handler = Arc::new(HostHandler {
|
||||
public_url: RwLock::new(None),
|
||||
@@ -75,7 +75,7 @@ impl NetworkService {
|
||||
/// Register a new protocol handler with the event loop.
|
||||
pub fn register_protocol(
|
||||
&self,
|
||||
handler: Arc<NetworkProtocolHandler + Send + Sync>,
|
||||
handler: Arc<dyn NetworkProtocolHandler + Send + Sync>,
|
||||
protocol: ProtocolId,
|
||||
// version id + packet count
|
||||
versions: &[(u8, u8)],
|
||||
@@ -192,7 +192,7 @@ impl NetworkService {
|
||||
/// Executes action in the network context
|
||||
pub fn with_context<F>(&self, protocol: ProtocolId, action: F)
|
||||
where
|
||||
F: FnOnce(&NetworkContext),
|
||||
F: FnOnce(&dyn NetworkContext),
|
||||
{
|
||||
let io = IoContext::new(self.io_service.channel(), 0);
|
||||
let host = self.host.read();
|
||||
@@ -204,7 +204,7 @@ impl NetworkService {
|
||||
/// Evaluates function in the network context
|
||||
pub fn with_context_eval<F, T>(&self, protocol: ProtocolId, action: F) -> Option<T>
|
||||
where
|
||||
F: FnOnce(&NetworkContext) -> T,
|
||||
F: FnOnce(&dyn NetworkContext) -> T,
|
||||
{
|
||||
let io = IoContext::new(self.io_service.channel(), 0);
|
||||
let host = self.host.read();
|
||||
|
||||
Reference in New Issue
Block a user