cpu usage finally fixed

This commit is contained in:
Luuk van Oijen
2023-11-20 18:30:17 +01:00
parent 6c2b131d72
commit a61554187e
3 changed files with 19 additions and 9 deletions

View File

@@ -233,11 +233,14 @@ impl Server {
if sent_mods.contains(&mod_id) { continue; }
debug!("[D] Starting download!");
let mut mod_name = {
if mod_id >= cfg_ref.mods.len() {
if mod_id < 0 {
break 'download;
}
if mod_id as usize >= cfg_ref.mods.len() {
break 'download;
}
let bmod = &cfg_ref.mods[mod_id]; // TODO: This is a bit uhh yeah
let bmod = &cfg_ref.mods[mod_id as usize]; // TODO: This is a bit uhh yeah
debug!("[D] Mod name: {}", bmod.0);
bmod.0.clone()
@@ -528,6 +531,11 @@ impl Server {
plugin.send_event(PluginBoundPluginEvent::CallEventHandler((ScriptEvent::OnPlayerDisconnect { pid: id, name: name.clone() }, None))).await;
}
{
let mut lock = CLIENT_MOD_PROGRESS.lock().await;
lock.insert(id, -1);
}
info!("Disconnecting client {}...", id);
if i == self.clients.len() - 1 {
self.clients.remove(i);