mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
more elaborate error handling
This commit is contained in:
parent
166653b355
commit
f0194e6d9b
@ -943,7 +943,7 @@ impl Client {
|
||||
_ = ping_interval.tick() => ping_stream.send(PingMsg::Ping)?,
|
||||
}
|
||||
};
|
||||
let missing_plugins_set = missing_plugins.iter().collect();
|
||||
let missing_plugins_set = missing_plugins.iter().cloned().collect();
|
||||
if !missing_plugins.is_empty() {
|
||||
stream.send(ClientGeneral::RequestPlugins(missing_plugins))?;
|
||||
}
|
||||
|
@ -279,22 +279,24 @@ impl PlayState for CharSelectionState {
|
||||
)));
|
||||
},
|
||||
client::Event::PluginDataReceived(data) => {
|
||||
tracing::info!("plugin data {}", data.len());
|
||||
let mut client = self.client.borrow_mut();
|
||||
#[cfg(feature = "plugins")]
|
||||
match client
|
||||
.state()
|
||||
.ecs()
|
||||
.write_resource::<PluginMgr>()
|
||||
.cache_server_plugin(&global_state.config_dir, data)
|
||||
{
|
||||
Ok(hash) => {
|
||||
if client.plugin_received(hash) == 0 {
|
||||
// now load characters (plugins might contain items)
|
||||
client.load_character_list();
|
||||
}
|
||||
},
|
||||
Err(e) => tracing::error!(?e, "cache_server_plugin"),
|
||||
tracing::info!("plugin data {}", data.len());
|
||||
let mut client = self.client.borrow_mut();
|
||||
let hash = client
|
||||
.state()
|
||||
.ecs()
|
||||
.write_resource::<PluginMgr>()
|
||||
.cache_server_plugin(&global_state.config_dir, data);
|
||||
match hash {
|
||||
Ok(hash) => {
|
||||
if client.plugin_received(hash) == 0 {
|
||||
// now load characters (plugins might contain items)
|
||||
client.load_character_list();
|
||||
}
|
||||
},
|
||||
Err(e) => tracing::error!(?e, "cache_server_plugin"),
|
||||
}
|
||||
}
|
||||
},
|
||||
// TODO: See if we should handle StartSpectate here instead.
|
||||
|
@ -223,11 +223,14 @@ impl PlayState for MainMenuState {
|
||||
// load local plugins needed by the server
|
||||
#[cfg(feature = "plugins")]
|
||||
for path in client.take_local_plugins().drain(..) {
|
||||
client
|
||||
if let Err(e) = client
|
||||
.state_mut()
|
||||
.ecs_mut()
|
||||
.write_resource::<PluginMgr>()
|
||||
.load_server_plugin(path);
|
||||
.load_server_plugin(path)
|
||||
{
|
||||
tracing::error!(?e, "load local plugin");
|
||||
}
|
||||
}
|
||||
// Register voxygen components / resources
|
||||
crate::ecs::init(client.state_mut().ecs_mut());
|
||||
@ -281,22 +284,25 @@ impl PlayState for MainMenuState {
|
||||
self.init = InitState::None;
|
||||
},
|
||||
client::Event::PluginDataReceived(data) => {
|
||||
tracing::info!("plugin data {}", data.len());
|
||||
if let InitState::Pipeline(client) = &mut self.init {
|
||||
#[cfg(feature = "plugins")]
|
||||
match client
|
||||
.state()
|
||||
.ecs()
|
||||
.write_resource::<PluginMgr>()
|
||||
.cache_server_plugin(&global_state.config_dir, data)
|
||||
{
|
||||
Ok(hash) => {
|
||||
if client.plugin_received(hash) == 0 {
|
||||
// now load characters (plugins might contain items)
|
||||
client.load_character_list();
|
||||
}
|
||||
},
|
||||
Err(e) => tracing::error!(?e, "cache_server_plugin"),
|
||||
#[cfg(feature = "plugins")]
|
||||
{
|
||||
tracing::info!("plugin data {}", data.len());
|
||||
if let InitState::Pipeline(client) = &mut self.init {
|
||||
let hash = client
|
||||
.state()
|
||||
.ecs()
|
||||
.write_resource::<PluginMgr>()
|
||||
.cache_server_plugin(&global_state.config_dir, data);
|
||||
match hash {
|
||||
Ok(hash) => {
|
||||
if client.plugin_received(hash) == 0 {
|
||||
// now load characters (plugins might contain
|
||||
// items)
|
||||
client.load_character_list();
|
||||
}
|
||||
},
|
||||
Err(e) => tracing::error!(?e, "cache_server_plugin"),
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user