feat: call start_watcher when connecting to an already running instance
(used to be only when starting the server)
This commit is contained in:
parent
c70527ded5
commit
bebca902df
2 changed files with 7 additions and 0 deletions
|
|
@ -240,6 +240,9 @@ async fn handle_login<T: MinecraftServerHandle>(
|
||||||
tracing::debug!(msg = "server status", status = ?status);
|
tracing::debug!(msg = "server status", status = ?status);
|
||||||
match status {
|
match status {
|
||||||
ServerDeploymentStatus::Connectable(mut server_stream) => {
|
ServerDeploymentStatus::Connectable(mut server_stream) => {
|
||||||
|
api.start_watch(server.clone(), Duration::from_secs(600))
|
||||||
|
.await?;
|
||||||
|
|
||||||
// referenced from:
|
// referenced from:
|
||||||
// https://github.com/hanyu-dev/tokio-splice2/blob/fc47199fffde8946b0acf867d1fa0b2222267a34/examples/proxy.rs
|
// https://github.com/hanyu-dev/tokio-splice2/blob/fc47199fffde8946b0acf867d1fa0b2222267a34/examples/proxy.rs
|
||||||
let io_sl2sr = tokio_splice2::context::SpliceIoCtx::prepare()
|
let io_sl2sr = tokio_splice2::context::SpliceIoCtx::prepare()
|
||||||
|
|
|
||||||
|
|
@ -123,6 +123,10 @@ pub trait MinecraftServerHandle: Clone {
|
||||||
|
|
||||||
pub trait MinecraftAPI<T> {
|
pub trait MinecraftAPI<T> {
|
||||||
async fn query_server(&self, addr: &str, port: &str) -> Result<T, OpaqueError>;
|
async fn query_server(&self, addr: &str, port: &str) -> Result<T, OpaqueError>;
|
||||||
|
|
||||||
|
// TODO: move the implementation to here, but
|
||||||
|
/// This should be callable even if there is already a watcher,
|
||||||
|
/// and it should handle the collision itself while returning OK().
|
||||||
async fn start_watch(
|
async fn start_watch(
|
||||||
self,
|
self,
|
||||||
server: impl MinecraftServerHandle,
|
server: impl MinecraftServerHandle,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue