Compare commits
8 Commits
Author | SHA1 | Date | |
---|---|---|---|
c3d1618ba8 | |||
|
37fdb9c12a | ||
|
e7a3db19aa | ||
|
ca4753673d | ||
|
0124aa723d | ||
|
afbc54758c | ||
|
e54025f02f | ||
|
023e46fe64 |
@@ -7,11 +7,6 @@ stages:
|
|||||||
- pre-release
|
- pre-release
|
||||||
- release
|
- release
|
||||||
|
|
||||||
default:
|
|
||||||
tags:
|
|
||||||
- linux
|
|
||||||
- timvisee-linux
|
|
||||||
|
|
||||||
# Variable defaults
|
# Variable defaults
|
||||||
variables:
|
variables:
|
||||||
RUST_VERSION: stable
|
RUST_VERSION: stable
|
||||||
|
@@ -1,5 +1,9 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## 0.2.10 (2023-02-20)
|
||||||
|
|
||||||
|
- Do not report an error when server exits with status code 143
|
||||||
|
|
||||||
## 0.2.9 (2023-02-14)
|
## 0.2.9 (2023-02-14)
|
||||||
|
|
||||||
- Fix dropping all connections when `server.drop_banned_ips` was enabled
|
- Fix dropping all connections when `server.drop_banned_ips` was enabled
|
||||||
|
2
Cargo.lock
generated
2
Cargo.lock
generated
@@ -926,7 +926,7 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "lazymc"
|
name = "lazymc"
|
||||||
version = "0.2.9"
|
version = "0.2.10"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"async-std",
|
"async-std",
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "lazymc"
|
name = "lazymc"
|
||||||
version = "0.2.9"
|
version = "0.2.10"
|
||||||
authors = ["Tim Visee <3a4fb3964f@sinenomine.email>"]
|
authors = ["Tim Visee <3a4fb3964f@sinenomine.email>"]
|
||||||
license = "GPL-3.0"
|
license = "GPL-3.0"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
@@ -50,7 +50,7 @@ dotenv = "0.15"
|
|||||||
flate2 = { version = "1.0", default-features = false, features = ["default"] }
|
flate2 = { version = "1.0", default-features = false, features = ["default"] }
|
||||||
futures = { version = "0.3", default-features = false, features = ["executor"] }
|
futures = { version = "0.3", default-features = false, features = ["executor"] }
|
||||||
log = "0.4"
|
log = "0.4"
|
||||||
minecraft-protocol = { git = "https://github.com/timvisee/rust-minecraft-protocol", rev = "edfdf87" }
|
minecraft-protocol = { git = "https://git.cozy.software/slime/rust-minecraft-protocol", rev = "4d9c0d4305" }
|
||||||
named-binary-tag = "0.6"
|
named-binary-tag = "0.6"
|
||||||
nix = "0.26"
|
nix = "0.26"
|
||||||
notify = "4.0"
|
notify = "4.0"
|
||||||
|
@@ -187,4 +187,4 @@ command = "java -Xmx1G -Xms1G -jar server.jar --nogui"
|
|||||||
[config]
|
[config]
|
||||||
# lazymc version this configuration is for.
|
# lazymc version this configuration is for.
|
||||||
# Don't change unless you know what you're doing.
|
# Don't change unless you know what you're doing.
|
||||||
version = "0.2.9"
|
version = "0.2.10"
|
||||||
|
@@ -57,13 +57,13 @@ pub async fn monitor_server(config: Arc<Config>, server: Arc<Server>) {
|
|||||||
|
|
||||||
// Sleep server when it's bedtime
|
// Sleep server when it's bedtime
|
||||||
if server.should_sleep(&config).await {
|
if server.should_sleep(&config).await {
|
||||||
info!(target: "lazymc::montior", "Server has been idle, sleeping...");
|
info!(target: "lazymc::monitor", "Server has been idle, sleeping...");
|
||||||
server.stop(&config).await;
|
server.stop(&config).await;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check whether we should force kill server
|
// Check whether we should force kill server
|
||||||
if server.should_kill().await {
|
if server.should_kill().await {
|
||||||
error!(target: "lazymc::montior", "Force killing server, took too long to start or stop");
|
error!(target: "lazymc::monitor", "Force killing server, took too long to start or stop");
|
||||||
if !server.force_kill().await {
|
if !server.force_kill().await {
|
||||||
warn!(target: "lazymc", "Failed to force kill server");
|
warn!(target: "lazymc", "Failed to force kill server");
|
||||||
}
|
}
|
||||||
|
@@ -70,7 +70,7 @@ async fn send_v1_16_3(
|
|||||||
packet::write_packet(
|
packet::write_packet(
|
||||||
Title {
|
Title {
|
||||||
action: if title.is_empty() && subtitle.is_empty() {
|
action: if title.is_empty() && subtitle.is_empty() {
|
||||||
// Defaults: https://minecraft.fandom.com/wiki/Commands/title#Detail
|
// Defaults: https://minecraft.wiki/w/Commands/title#Detail
|
||||||
TitleAction::SetTimesAndDisplay {
|
TitleAction::SetTimesAndDisplay {
|
||||||
fade_in: 10,
|
fade_in: 10,
|
||||||
stay: 70,
|
stay: 70,
|
||||||
@@ -121,7 +121,7 @@ async fn send_v1_17(
|
|||||||
// Set title times
|
// Set title times
|
||||||
packet::write_packet(
|
packet::write_packet(
|
||||||
if title.is_empty() && subtitle.is_empty() {
|
if title.is_empty() && subtitle.is_empty() {
|
||||||
// Defaults: https://minecraft.fandom.com/wiki/Commands/title#Detail
|
// Defaults: https://minecraft.wiki/w/Commands/title#Detail
|
||||||
SetTitleTimes {
|
SetTitleTimes {
|
||||||
fade_in: 10,
|
fade_in: 10,
|
||||||
stay: 70,
|
stay: 70,
|
||||||
|
@@ -29,9 +29,11 @@ const SERVER_QUIT_COOLDOWN: Duration = Duration::from_millis(2500);
|
|||||||
#[cfg(feature = "rcon")]
|
#[cfg(feature = "rcon")]
|
||||||
const RCON_COOLDOWN: Duration = Duration::from_secs(15);
|
const RCON_COOLDOWN: Duration = Duration::from_secs(15);
|
||||||
|
|
||||||
/// Exit code when SIGTERM is received on Unix.
|
/// Exit codes that are allowed.
|
||||||
#[cfg(unix)]
|
///
|
||||||
const UNIX_EXIT_SIGTERM: i32 = 130;
|
/// - 143: https://github.com/timvisee/lazymc/issues/26#issuecomment-1435670029
|
||||||
|
/// - 130: https://unix.stackexchange.com/q/386836/61092
|
||||||
|
const ALLOWED_EXIT_CODES: [i32; 2] = [130, 143];
|
||||||
|
|
||||||
/// Shared server state.
|
/// Shared server state.
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
@@ -496,8 +498,12 @@ pub async fn invoke_server_cmd(
|
|||||||
debug!(target: "lazymc", "Server process stopped successfully ({})", status);
|
debug!(target: "lazymc", "Server process stopped successfully ({})", status);
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
#[cfg(unix)]
|
Ok(status)
|
||||||
Ok(status) if status.code() == Some(UNIX_EXIT_SIGTERM) => {
|
if status
|
||||||
|
.code()
|
||||||
|
.map(|ref code| ALLOWED_EXIT_CODES.contains(code))
|
||||||
|
.unwrap_or(false) =>
|
||||||
|
{
|
||||||
debug!(target: "lazymc", "Server process stopped successfully by SIGTERM ({})", status);
|
debug!(target: "lazymc", "Server process stopped successfully by SIGTERM ({})", status);
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
|
@@ -232,11 +232,11 @@ async fn server_status(client_info: &ClientInfo, config: &Config, server: &Serve
|
|||||||
if config.motd.from_server && status.is_some() {
|
if config.motd.from_server && status.is_some() {
|
||||||
status.as_ref().unwrap().description.clone()
|
status.as_ref().unwrap().description.clone()
|
||||||
} else {
|
} else {
|
||||||
Message::new(Payload::text(match server_state {
|
match server_state {
|
||||||
server::State::Stopped | server::State::Started => &config.motd.sleeping,
|
server::State::Stopped | server::State::Started => &config.motd.sleeping,
|
||||||
server::State::Starting => &config.motd.starting,
|
server::State::Starting => &config.motd.starting,
|
||||||
server::State::Stopping => &config.motd.stopping,
|
server::State::Stopping => &config.motd.stopping,
|
||||||
}))
|
}.to_string()
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user