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)?,
|
_ = 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() {
|
if !missing_plugins.is_empty() {
|
||||||
stream.send(ClientGeneral::RequestPlugins(missing_plugins))?;
|
stream.send(ClientGeneral::RequestPlugins(missing_plugins))?;
|
||||||
}
|
}
|
||||||
|
@ -279,15 +279,16 @@ impl PlayState for CharSelectionState {
|
|||||||
)));
|
)));
|
||||||
},
|
},
|
||||||
client::Event::PluginDataReceived(data) => {
|
client::Event::PluginDataReceived(data) => {
|
||||||
|
#[cfg(feature = "plugins")]
|
||||||
|
{
|
||||||
tracing::info!("plugin data {}", data.len());
|
tracing::info!("plugin data {}", data.len());
|
||||||
let mut client = self.client.borrow_mut();
|
let mut client = self.client.borrow_mut();
|
||||||
#[cfg(feature = "plugins")]
|
let hash = client
|
||||||
match client
|
|
||||||
.state()
|
.state()
|
||||||
.ecs()
|
.ecs()
|
||||||
.write_resource::<PluginMgr>()
|
.write_resource::<PluginMgr>()
|
||||||
.cache_server_plugin(&global_state.config_dir, data)
|
.cache_server_plugin(&global_state.config_dir, data);
|
||||||
{
|
match hash {
|
||||||
Ok(hash) => {
|
Ok(hash) => {
|
||||||
if client.plugin_received(hash) == 0 {
|
if client.plugin_received(hash) == 0 {
|
||||||
// now load characters (plugins might contain items)
|
// now load characters (plugins might contain items)
|
||||||
@ -296,6 +297,7 @@ impl PlayState for CharSelectionState {
|
|||||||
},
|
},
|
||||||
Err(e) => tracing::error!(?e, "cache_server_plugin"),
|
Err(e) => tracing::error!(?e, "cache_server_plugin"),
|
||||||
}
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
// TODO: See if we should handle StartSpectate here instead.
|
// TODO: See if we should handle StartSpectate here instead.
|
||||||
_ => {},
|
_ => {},
|
||||||
|
@ -223,11 +223,14 @@ impl PlayState for MainMenuState {
|
|||||||
// load local plugins needed by the server
|
// load local plugins needed by the server
|
||||||
#[cfg(feature = "plugins")]
|
#[cfg(feature = "plugins")]
|
||||||
for path in client.take_local_plugins().drain(..) {
|
for path in client.take_local_plugins().drain(..) {
|
||||||
client
|
if let Err(e) = client
|
||||||
.state_mut()
|
.state_mut()
|
||||||
.ecs_mut()
|
.ecs_mut()
|
||||||
.write_resource::<PluginMgr>()
|
.write_resource::<PluginMgr>()
|
||||||
.load_server_plugin(path);
|
.load_server_plugin(path)
|
||||||
|
{
|
||||||
|
tracing::error!(?e, "load local plugin");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// Register voxygen components / resources
|
// Register voxygen components / resources
|
||||||
crate::ecs::init(client.state_mut().ecs_mut());
|
crate::ecs::init(client.state_mut().ecs_mut());
|
||||||
@ -281,24 +284,27 @@ impl PlayState for MainMenuState {
|
|||||||
self.init = InitState::None;
|
self.init = InitState::None;
|
||||||
},
|
},
|
||||||
client::Event::PluginDataReceived(data) => {
|
client::Event::PluginDataReceived(data) => {
|
||||||
|
#[cfg(feature = "plugins")]
|
||||||
|
{
|
||||||
tracing::info!("plugin data {}", data.len());
|
tracing::info!("plugin data {}", data.len());
|
||||||
if let InitState::Pipeline(client) = &mut self.init {
|
if let InitState::Pipeline(client) = &mut self.init {
|
||||||
#[cfg(feature = "plugins")]
|
let hash = client
|
||||||
match client
|
|
||||||
.state()
|
.state()
|
||||||
.ecs()
|
.ecs()
|
||||||
.write_resource::<PluginMgr>()
|
.write_resource::<PluginMgr>()
|
||||||
.cache_server_plugin(&global_state.config_dir, data)
|
.cache_server_plugin(&global_state.config_dir, data);
|
||||||
{
|
match hash {
|
||||||
Ok(hash) => {
|
Ok(hash) => {
|
||||||
if client.plugin_received(hash) == 0 {
|
if client.plugin_received(hash) == 0 {
|
||||||
// now load characters (plugins might contain items)
|
// now load characters (plugins might contain
|
||||||
|
// items)
|
||||||
client.load_character_list();
|
client.load_character_list();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
Err(e) => tracing::error!(?e, "cache_server_plugin"),
|
Err(e) => tracing::error!(?e, "cache_server_plugin"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
_ => {},
|
_ => {},
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user