mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-14 22:41:06 +00:00
Remove NetworkSpecialization::on_event (#3976)
This commit is contained in:
committed by
Gavin Wood
parent
4264613a96
commit
eb3c950cfe
@@ -515,10 +515,6 @@ impl<B: BlockT, S: NetworkSpecialization<B>, H: ExHashT> Protocol<B, S, H> {
|
|||||||
self.context_data.peers.iter().map(|(id, peer)| (id, &peer.info))
|
self.context_data.peers.iter().map(|(id, peer)| (id, &peer.info))
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn on_event(&mut self, event: Event) {
|
|
||||||
self.specialization.on_event(event);
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn on_custom_message(
|
pub fn on_custom_message(
|
||||||
&mut self,
|
&mut self,
|
||||||
who: PeerId,
|
who: PeerId,
|
||||||
|
|||||||
@@ -42,7 +42,8 @@ pub trait NetworkSpecialization<B: BlockT>: Send + Sync + 'static {
|
|||||||
);
|
);
|
||||||
|
|
||||||
/// Called when a network-specific event arrives.
|
/// Called when a network-specific event arrives.
|
||||||
fn on_event(&mut self, event: Event);
|
#[deprecated(note = "This method is never called; please use `with_dht_event_tx` when building the service")]
|
||||||
|
fn on_event(&mut self, event: Event) {}
|
||||||
|
|
||||||
/// Called on abort.
|
/// Called on abort.
|
||||||
#[deprecated(note = "This method is never called; aborting corresponds to dropping the object")]
|
#[deprecated(note = "This method is never called; aborting corresponds to dropping the object")]
|
||||||
|
|||||||
@@ -480,8 +480,8 @@ impl<B: BlockT + 'static, S: NetworkSpecialization<B>, H: ExHashT> NetworkServic
|
|||||||
|
|
||||||
/// Start getting a value from the DHT.
|
/// Start getting a value from the DHT.
|
||||||
///
|
///
|
||||||
/// This will generate either a `ValueFound` or a `ValueNotFound` event and pass it to
|
/// This will generate either a `ValueFound` or a `ValueNotFound` event and pass it as an
|
||||||
/// `on_event` on the network specialization.
|
/// item on the [`NetworkWorker`] stream.
|
||||||
pub fn get_value(&self, key: &record::Key) {
|
pub fn get_value(&self, key: &record::Key) {
|
||||||
let _ = self
|
let _ = self
|
||||||
.to_worker
|
.to_worker
|
||||||
@@ -490,8 +490,8 @@ impl<B: BlockT + 'static, S: NetworkSpecialization<B>, H: ExHashT> NetworkServic
|
|||||||
|
|
||||||
/// Start putting a value in the DHT.
|
/// Start putting a value in the DHT.
|
||||||
///
|
///
|
||||||
/// This will generate either a `ValuePut` or a `ValuePutFailed` event and pass it to
|
/// This will generate either a `ValuePut` or a `ValuePutFailed` event and pass it as an
|
||||||
/// `on_event` on the network specialization.
|
/// item on the [`NetworkWorker`] stream.
|
||||||
pub fn put_value(&self, key: record::Key, value: Vec<u8>) {
|
pub fn put_value(&self, key: record::Key, value: Vec<u8>) {
|
||||||
let _ = self
|
let _ = self
|
||||||
.to_worker
|
.to_worker
|
||||||
@@ -718,12 +718,8 @@ impl<B: BlockT + 'static, S: NetworkSpecialization<B>, H: ExHashT> Stream for Ne
|
|||||||
let outcome = match poll_value {
|
let outcome = match poll_value {
|
||||||
Ok(Async::NotReady) => break,
|
Ok(Async::NotReady) => break,
|
||||||
Ok(Async::Ready(Some(BehaviourOut::SubstrateAction(outcome)))) => outcome,
|
Ok(Async::Ready(Some(BehaviourOut::SubstrateAction(outcome)))) => outcome,
|
||||||
Ok(Async::Ready(Some(BehaviourOut::Dht(ev)))) => {
|
Ok(Async::Ready(Some(BehaviourOut::Dht(ev)))) =>
|
||||||
self.network_service.user_protocol_mut()
|
return Ok(Async::Ready(Some(Event::Dht(ev)))),
|
||||||
.on_event(Event::Dht(ev.clone()));
|
|
||||||
|
|
||||||
return Ok(Async::Ready(Some(Event::Dht(ev))));
|
|
||||||
},
|
|
||||||
Ok(Async::Ready(None)) => CustomMessageOutcome::None,
|
Ok(Async::Ready(None)) => CustomMessageOutcome::None,
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
error!(target: "sync", "Error in the network: {:?}", err);
|
error!(target: "sync", "Error in the network: {:?}", err);
|
||||||
|
|||||||
@@ -124,11 +124,6 @@ impl NetworkSpecialization<Block> for DummySpecialization {
|
|||||||
_peer_id: PeerId,
|
_peer_id: PeerId,
|
||||||
_message: Vec<u8>,
|
_message: Vec<u8>,
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
fn on_event(
|
|
||||||
&mut self,
|
|
||||||
_event: crate::specialization::Event
|
|
||||||
) {}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub type PeersFullClient =
|
pub type PeersFullClient =
|
||||||
|
|||||||
Reference in New Issue
Block a user