feat: handle SIGTREM
All checks were successful
/ build (push) Successful in 2m56s

This commit is contained in:
Tamipes 2026-06-08 17:02:34 +02:00
parent ac8812be2f
commit 29ff12f115
7 changed files with 111 additions and 69 deletions

View file

@ -1,5 +1,6 @@
use std::{collections::HashMap, sync::Arc};
use async_trait::async_trait;
use tokio::{io::AsyncWriteExt, net::TcpStream};
use tracing::Instrument;
@ -64,7 +65,7 @@ pub async fn send_disconnect(
}
#[async_trait::async_trait]
pub trait MinecraftServerHandle: Clone {
pub trait MinecraftServerHandle: Send + Sync + 'static + Clone {
async fn start(&self) -> Result<(), OpaqueError>;
async fn stop(&self) -> Result<(), OpaqueError>;
async fn query_status(&self) -> Result<ServerDeploymentStatus, OpaqueError>;
@ -156,7 +157,8 @@ pub trait MinecraftServerHandle: Clone {
}
}
pub trait MinecraftAPI<T> {
#[async_trait]
pub trait MinecraftAPI<T>: Send + Sync + 'static {
async fn query_server(&self, addr: &str, port: &str) -> Result<T, OpaqueError>;
fn get_map(&self) -> Arc<tokio::sync::Mutex<HashMap<String, tokio::task::JoinHandle<()>>>>;