Move Engine::register_client to be before other I/O handler registration (#10767)

This commit is contained in:
Wei Tang 2019-06-24 15:10:42 +02:00 committed by GitHub
parent f2dd032884
commit 02eb046774
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 4 deletions

View File

@ -75,9 +75,8 @@ impl<T: ChainDataFetcher> Service<T> {
io_service.channel(), io_service.channel(),
cache, cache,
)?); )?);
io_service.register_handler(Arc::new(ImportBlocks(client.clone()))).map_err(Error::Io)?;
spec.engine.register_client(Arc::downgrade(&client) as _); spec.engine.register_client(Arc::downgrade(&client) as _);
io_service.register_handler(Arc::new(ImportBlocks(client.clone()))).map_err(Error::Io)?;
Ok(Service { Ok(Service {
client, client,

View File

@ -113,6 +113,7 @@ impl ClientService {
miner.clone(), miner.clone(),
io_service.channel(), io_service.channel(),
)?; )?;
spec.engine.register_client(Arc::downgrade(&client) as _);
miner.set_io_channel(io_service.channel()); miner.set_io_channel(io_service.channel());
miner.set_in_chain_checker(&client.clone()); miner.set_in_chain_checker(&client.clone());
@ -148,8 +149,6 @@ impl ClientService {
}); });
io_service.register_handler(client_io)?; io_service.register_handler(client_io)?;
spec.engine.register_client(Arc::downgrade(&client) as _);
Ok(ClientService { Ok(ClientService {
io_service: Arc::new(io_service), io_service: Arc::new(io_service),
client: client, client: client,