,
}
+impl IntoExit for CollationNode
where
+ P: ParachainContext + Send + 'static,
+ E: Future- + Send + 'static
+{
+ type Exit = E;
+ fn into_exit(self) -> Self::Exit {
+ self.exit
+ }
+}
+
impl
Worker for CollationNode
where
P: ParachainContext + Send + 'static,
- E: Future- + Send + Clone + 'static
+ E: Future
- + Send + 'static
{
type Work = Box + Send>;
- type Exit = E;
fn configuration(&self) -> CustomConfiguration {
let mut config = CustomConfiguration::default();
@@ -227,10 +236,6 @@ impl
Worker for CollationNode
where
config
}
- fn exit_only(&self) -> Self::Exit {
- self.exit.clone()
- }
-
fn work(self, service: &Service) -> Self::Work {
let CollationNode { parachain_context, exit, para_id, key } = self;
let client = service.client();
diff --git a/polkadot/src/main.rs b/polkadot/src/main.rs
index 4e3fba054f..d3e951596e 100644
--- a/polkadot/src/main.rs
+++ b/polkadot/src/main.rs
@@ -38,11 +38,9 @@ mod vergen {
// the regular polkadot worker simply does nothing until ctrl-c
struct Worker;
-impl cli::Worker for Worker {
- type Work = Self::Exit;
+impl cli::IntoExit for Worker {
type Exit = future::MapErr, fn(oneshot::Canceled) -> ()>;
-
- fn exit_only(&self) -> Self::Exit {
+ fn into_exit(self) -> Self::Exit {
// can't use signal directly here because CtrlC takes only `Fn`.
let (exit_send, exit) = oneshot::channel();
@@ -55,9 +53,13 @@ impl cli::Worker for Worker {
exit.map_err(drop)
}
+}
- fn work(self, _service: &Service) -> Self::Exit {
- self.exit_only()
+impl cli::Worker for Worker {
+ type Work = ::Exit;
+ fn work(self, _service: &Service) -> Self::Work {
+ use cli::IntoExit;
+ self.into_exit()
}
}