summaryrefslogtreecommitdiff
path: root/server
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2025-06-03 20:00:18 +0200
committermetamuffin <metamuffin@disroot.org>2025-06-03 20:00:18 +0200
commitdb4587d3ec64b7e28691b43f9d9701939eed94d1 (patch)
tree1005017ea4a5d4e287024eaf08f876c7e34bfbdb /server
parent9ee7eef2919feffe4e0695494d4027e8ec011808 (diff)
downloadhurrycurry-db4587d3ec64b7e28691b43f9d9701939eed94d1.tar
hurrycurry-db4587d3ec64b7e28691b43f9d9701939eed94d1.tar.bz2
hurrycurry-db4587d3ec64b7e28691b43f9d9701939eed94d1.tar.zst
update rust toolchain and rust dependencies.
`map_many_mut` and `trait_upcasting` was stabilized.
Diffstat (limited to 'server')
-rw-r--r--server/Cargo.toml30
-rw-r--r--server/bot/Cargo.toml12
-rw-r--r--server/bot/src/algos/customer.rs4
-rw-r--r--server/bot/src/algos/frank.rs4
-rw-r--r--server/client-lib/Cargo.toml16
-rw-r--r--server/client-lib/src/lib.rs4
-rw-r--r--server/client-lib/src/network/sync.rs9
-rw-r--r--server/client-lib/src/network/tokio.rs10
-rw-r--r--server/discover/Cargo.toml14
-rw-r--r--server/editor/Cargo.toml18
-rw-r--r--server/editor/src/main.rs2
-rw-r--r--server/protocol/Cargo.toml6
-rw-r--r--server/registry/Cargo.toml16
-rw-r--r--server/registry/src/lobby.rs6
-rw-r--r--server/replaytool/Cargo.toml24
-rw-r--r--server/replaytool/src/main.rs9
-rw-r--r--server/src/entity/conveyor.rs3
-rw-r--r--server/src/entity/item_portal.rs2
-rw-r--r--server/src/lib.rs9
-rw-r--r--server/src/main.rs10
-rw-r--r--server/src/scoreboard.rs8
-rw-r--r--server/src/server.rs4
22 files changed, 112 insertions, 108 deletions
diff --git a/server/Cargo.toml b/server/Cargo.toml
index 8f68fd17..56873616 100644
--- a/server/Cargo.toml
+++ b/server/Cargo.toml
@@ -5,31 +5,31 @@ edition = "2021"
default-run = "hurrycurry-server"
[dependencies]
-log = "0.4.22"
-env_logger = "0.11.5"
-anyhow = "1.0.89"
-serde = { version = "1.0.210", features = ["derive"] }
-tokio = { version = "1.40.0", features = ["full"] }
-serde_json = "1.0.128"
-tokio-tungstenite = "0.24.0"
-futures-util = "0.3.30"
+log = "0.4.27"
+env_logger = "0.11.8"
+anyhow = "1.0.98"
+serde = { version = "1.0.219", features = ["derive"] }
+tokio = { version = "1.45.1", features = ["full"] }
+serde_json = "1.0.140"
+tokio-tungstenite = "0.26.2"
+futures-util = "0.3.31"
serde_yml = "0.0.12"
-rand = "0.9.0-alpha.2"
+rand = "0.9.1"
rand_distr = "0.5.1"
shlex = "1.3.0"
-clap = { version = "4.5.18", features = ["derive"] }
-reqwest = { version = "0.12.7", optional = true, default-features = false, features = [
+clap = { version = "4.5.39", features = ["derive"] }
+reqwest = { version = "0.12.19", optional = true, default-features = false, features = [
"json",
"http2",
"charset",
"rustls-tls-native-roots",
] }
-pollster = "0.3.0"
-bincode = "2.0.0-rc.3"
-xdg = "2.5.2"
+pollster = "0.4.0"
+bincode = "2.0.1"
+xdg = "3.0.0"
igd = { version = "0.12.1", optional = true, features = ["aio"] }
get_if_addrs = { version = "0.5.3", optional = true }
-mdns-sd = { version = "0.11.4", optional = true }
+mdns-sd = { version = "0.13.9", optional = true }
hurrycurry-protocol = { path = "protocol" }
hurrycurry-client-lib = { path = "client-lib" }
diff --git a/server/bot/Cargo.toml b/server/bot/Cargo.toml
index 7f371867..7faa6b0f 100644
--- a/server/bot/Cargo.toml
+++ b/server/bot/Cargo.toml
@@ -6,9 +6,9 @@ edition = "2021"
[dependencies]
hurrycurry-client-lib = { path = "../client-lib", features = ["tokio-network"] }
hurrycurry-protocol = { path = "../protocol" }
-log = "0.4.22"
-anyhow = "1.0.89"
-env_logger = "0.11.5"
-rustls = { version = "0.23.13", features = ["ring"] }
-clap = { version = "4.5.18", features = ["derive"] }
-rand = "0.9.0-alpha.2"
+log = "0.4.27"
+anyhow = "1.0.98"
+env_logger = "0.11.8"
+rustls = { version = "0.23.27", features = ["ring"] }
+clap = { version = "4.5.39", features = ["derive"] }
+rand = "0.9.1"
diff --git a/server/bot/src/algos/customer.rs b/server/bot/src/algos/customer.rs
index b0ece9dd..9e7ae094 100644
--- a/server/bot/src/algos/customer.rs
+++ b/server/bot/src/algos/customer.rs
@@ -25,7 +25,7 @@ use hurrycurry_protocol::{
DemandIndex, Hand, Message, PacketS, PlayerClass, PlayerID, Score,
};
use log::info;
-use rand::{random, seq::IndexedRandom, thread_rng};
+use rand::{random, rng, seq::IndexedRandom};
#[derive(Debug, Clone, Default)]
pub struct Customer {
@@ -109,7 +109,7 @@ impl CustomerState {
.filter(|(_, t)| game.data.tile_name(t.kind) == "chair")
.map(|(p, _)| *p)
.collect::<Vec<_>>()
- .choose(&mut thread_rng())
+ .choose(&mut rng())
{
if let Some(path) = find_path(&game.walkable, pos.as_ivec2(), chair) {
info!("{me:?} -> entering");
diff --git a/server/bot/src/algos/frank.rs b/server/bot/src/algos/frank.rs
index 47b8ca7d..38ee927c 100644
--- a/server/bot/src/algos/frank.rs
+++ b/server/bot/src/algos/frank.rs
@@ -21,7 +21,7 @@ use crate::{
};
use hurrycurry_client_lib::Game;
use hurrycurry_protocol::{glam::Vec2, Message, PacketS, PlayerClass, PlayerID};
-use rand::{random, seq::IndexedRandom, thread_rng};
+use rand::{random, rng, seq::IndexedRandom};
#[derive(Default)]
pub struct Frank {
@@ -110,5 +110,5 @@ fn find_chef(game: &Game, me: PlayerID) -> Option<PlayerID> {
.filter(|(i, p)| p.class == PlayerClass::Chef && **i != me)
.map(|(i, _)| *i)
.collect::<Vec<_>>();
- chefs.choose(&mut thread_rng()).copied()
+ chefs.choose(&mut rng()).copied()
}
diff --git a/server/client-lib/Cargo.toml b/server/client-lib/Cargo.toml
index 95456595..5c229e2b 100644
--- a/server/client-lib/Cargo.toml
+++ b/server/client-lib/Cargo.toml
@@ -5,18 +5,18 @@ edition = "2021"
[dependencies]
hurrycurry-protocol = { path = "../protocol" }
-tungstenite = { version = "0.24.0", optional = true, features = [
+tungstenite = { version = "0.26.2", optional = true, features = [
"rustls-tls-native-roots",
] }
-tokio-tungstenite = { version = "0.24.0", optional = true, features = [
+tokio-tungstenite = { version = "0.26.2", optional = true, features = [
"rustls-tls-native-roots",
] }
-tokio = { version = "1.40.0", features = ["net", "sync"], optional = true }
-serde_json = "1.0.128"
-bincode = "2.0.0-rc.3"
-log = "0.4.22"
-anyhow = "1.0.89"
-futures-util = { version = "0.3.30", optional = true }
+tokio = { version = "1.45.1", features = ["net", "sync"], optional = true }
+serde_json = "1.0.140"
+bincode = "2.0.1"
+log = "0.4.27"
+anyhow = "1.0.98"
+futures-util = { version = "0.3.31", optional = true }
[features]
default = ["sync-network", "tokio-network"]
diff --git a/server/client-lib/src/lib.rs b/server/client-lib/src/lib.rs
index a40eafc1..f59b3dc3 100644
--- a/server/client-lib/src/lib.rs
+++ b/server/client-lib/src/lib.rs
@@ -15,7 +15,7 @@
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-#![feature(map_many_mut, let_chains)]
+#![feature(let_chains)]
pub mod network;
pub mod spatial_index;
@@ -234,7 +234,7 @@ impl Game {
self.players_spatial_index.all(|p1, pos1| {
self.players_spatial_index.query(pos1, 2., |p2, _pos2| {
- if let [Some(a), Some(b)] = self.players.get_many_mut([&p1, &p2]) {
+ if let [Some(a), Some(b)] = self.players.get_disjoint_mut([&p1, &p2]) {
a.movement.collide(&mut b.movement, dt)
}
})
diff --git a/server/client-lib/src/network/sync.rs b/server/client-lib/src/network/sync.rs
index 02e612f4..45e84829 100644
--- a/server/client-lib/src/network/sync.rs
+++ b/server/client-lib/src/network/sync.rs
@@ -131,13 +131,12 @@ impl Network {
for packet in self.queue_out.drain(..) {
debug!("-> {packet:?}");
if self.use_bincode {
- self.sock.write(Message::Binary(bincode::encode_to_vec(
- &packet,
- BINCODE_CONFIG,
- )?))?;
+ self.sock.write(Message::Binary(
+ bincode::encode_to_vec(&packet, BINCODE_CONFIG)?.into(),
+ ))?;
} else {
self.sock
- .write(Message::Text(serde_json::to_string(&packet)?))?;
+ .write(Message::Text(serde_json::to_string(&packet)?.into()))?;
}
}
diff --git a/server/client-lib/src/network/tokio.rs b/server/client-lib/src/network/tokio.rs
index 3f68e091..f9f34172 100644
--- a/server/client-lib/src/network/tokio.rs
+++ b/server/client-lib/src/network/tokio.rs
@@ -130,12 +130,16 @@ impl Network {
let mut g = self.sock_send.write().await;
if self.use_bincode.load(Ordering::Relaxed) {
g.send(Message::Binary(
- bincode::encode_to_vec(&packet, BINCODE_CONFIG).unwrap(),
+ bincode::encode_to_vec(&packet, BINCODE_CONFIG)
+ .unwrap()
+ .into(),
))
.await?;
} else {
- g.send(Message::Text(serde_json::to_string(&packet).unwrap()))
- .await?;
+ g.send(Message::Text(
+ serde_json::to_string(&packet).unwrap().into(),
+ ))
+ .await?;
}
Ok(())
}
diff --git a/server/discover/Cargo.toml b/server/discover/Cargo.toml
index 4faa9bc1..3b622f09 100644
--- a/server/discover/Cargo.toml
+++ b/server/discover/Cargo.toml
@@ -4,16 +4,16 @@ version = "2.3.1"
edition = "2021"
[dependencies]
-mdns-sd = "0.11.4"
-env_logger = "0.11.5"
-log = "0.4.22"
-anyhow = "1.0.89"
-hyper = { version = "1.4.1", default-features = false, features = [
+mdns-sd = "0.13.9"
+env_logger = "0.11.8"
+log = "0.4.27"
+anyhow = "1.0.98"
+hyper = { version = "1.6.0", default-features = false, features = [
"server",
"http1",
] }
-tokio = { version = "1.40.0", features = ["full"] }
+tokio = { version = "1.45.1", features = ["full"] }
http-body-util = "0.1"
hyper-util = { version = "0.1", features = ["full"] }
hurrycurry-protocol = { path = "../protocol" }
-serde_json = "1.0.128"
+serde_json = "1.0.140"
diff --git a/server/editor/Cargo.toml b/server/editor/Cargo.toml
index 4c0fa307..d9dacffc 100644
--- a/server/editor/Cargo.toml
+++ b/server/editor/Cargo.toml
@@ -4,17 +4,17 @@ version = "0.1.0"
edition = "2024"
[dependencies]
-tokio = { version = "1.40.0", features = ["full"] }
-serde_json = "1.0.128"
-log = "0.4.22"
-env_logger = "0.11.5"
-anyhow = "1.0.89"
-tokio-tungstenite = { version = "0.24.0", features = [
+tokio = { version = "1.45.1", features = ["full"] }
+serde_json = "1.0.140"
+log = "0.4.27"
+env_logger = "0.11.8"
+anyhow = "1.0.98"
+tokio-tungstenite = { version = "0.26.2", features = [
"rustls-tls-native-roots",
] }
-serde = { version = "1.0.216", features = ["derive"] }
-rustls = { version = "0.23.13", features = ["ring"] }
-clap = { version = "4.5.23", features = ["derive"] }
+serde = { version = "1.0.219", features = ["derive"] }
+rustls = { version = "0.23.27", features = ["ring"] }
+clap = { version = "4.5.39", features = ["derive"] }
futures-util = "0.3.31"
shlex = "1.3.0"
serde_yml = "0.0.12"
diff --git a/server/editor/src/main.rs b/server/editor/src/main.rs
index 620daeb5..c7cb7933 100644
--- a/server/editor/src/main.rs
+++ b/server/editor/src/main.rs
@@ -168,7 +168,7 @@ async fn handle_conn(
debug!("-> {p:?}");
write
.send(tokio_tungstenite::tungstenite::Message::Text(
- serde_json::to_string(&p).unwrap(),
+ serde_json::to_string(&p).unwrap().into(),
))
.await?;
}
diff --git a/server/protocol/Cargo.toml b/server/protocol/Cargo.toml
index 41328684..cec19d4e 100644
--- a/server/protocol/Cargo.toml
+++ b/server/protocol/Cargo.toml
@@ -4,6 +4,6 @@ version = "9.0.0"
edition = "2021"
[dependencies]
-serde = { version = "1.0.210", features = ["derive"] }
-glam = { version = "0.29.0", features = ["serde"] }
-bincode = { version = "2.0.0-rc.3", features = ["serde", "derive"] }
+serde = { version = "1.0.219", features = ["derive"] }
+glam = { version = "0.30.3", features = ["serde"] }
+bincode = { version = "2.0.1", features = ["serde", "derive"] }
diff --git a/server/registry/Cargo.toml b/server/registry/Cargo.toml
index 9108f056..3b1c7137 100644
--- a/server/registry/Cargo.toml
+++ b/server/registry/Cargo.toml
@@ -4,18 +4,18 @@ version = "2.3.1"
edition = "2021"
[dependencies]
-log = "0.4.22"
-env_logger = "0.11.5"
-anyhow = "1.0.89"
+log = "0.4.27"
+env_logger = "0.11.8"
+anyhow = "1.0.98"
rocket = { version = "0.5.1", features = ["json"] }
-tokio = { version = "1.40.0", features = ["full"] }
-serde_json = "1.0.128"
+tokio = { version = "1.45.1", features = ["full"] }
+serde_json = "1.0.140"
markup = "0.15.0"
-serde = { version = "1.0.210", features = ["derive"] }
-tokio-tungstenite = { version = "0.24.0", features = [
+serde = { version = "1.0.219", features = ["derive"] }
+tokio-tungstenite = { version = "0.26.2", features = [
"rustls-tls-native-roots",
] }
-rustls = { version = "0.23.13", features = ["ring"] }
+rustls = { version = "0.23.27", features = ["ring"] }
hurrycurry-protocol = { path = "../protocol" }
hurrycurry-client-lib = { path = "../client-lib" }
diff --git a/server/registry/src/lobby.rs b/server/registry/src/lobby.rs
index f8f5f1f2..36ef9e44 100644
--- a/server/registry/src/lobby.rs
+++ b/server/registry/src/lobby.rs
@@ -97,17 +97,17 @@ async fn handle_conn(sock: TcpStream, addr: SocketAddr, entries: &[Entry]) -> Re
});
let (mut write, mut read) = sock.split();
-
+
let mut joined = false;
let mut redirected = false;
let mut movement = MovementBase::new(Vec2::ZERO);
let mut last_movement = Instant::now();
-
+
loop {
for p in out.drain(..) {
write
.send(tokio_tungstenite::tungstenite::Message::Text(
- serde_json::to_string(&p).unwrap(),
+ serde_json::to_string(&p).unwrap().into(),
))
.await?;
}
diff --git a/server/replaytool/Cargo.toml b/server/replaytool/Cargo.toml
index 9d5ac20a..dfc0db64 100644
--- a/server/replaytool/Cargo.toml
+++ b/server/replaytool/Cargo.toml
@@ -4,19 +4,19 @@ version = "0.1.0"
edition = "2021"
[dependencies]
-log = "0.4.22"
-env_logger = "0.11.5"
-anyhow = "1.0.89"
-serde = { version = "1.0.210", features = ["derive"] }
-tokio = { version = "1.40.0", features = ["full"] }
-serde_json = "1.0.128"
-tokio-tungstenite = { version = "0.24.0", features = [
+log = "0.4.27"
+env_logger = "0.11.8"
+anyhow = "1.0.98"
+serde = { version = "1.0.219", features = ["derive"] }
+tokio = { version = "1.45.1", features = ["full"] }
+serde_json = "1.0.140"
+tokio-tungstenite = { version = "0.26.2", features = [
"rustls-tls-native-roots",
] }
-futures-util = "0.3.30"
-rand = "0.9.0-alpha.2"
-clap = { version = "4.5.18", features = ["derive"] }
-async-compression = { version = "0.4.12", features = ["zstd", "tokio"] }
-rustls = { version = "0.23.13", features = ["ring"] }
+futures-util = "0.3.31"
+rand = "0.9.1"
+clap = { version = "4.5.39", features = ["derive"] }
+async-compression = { version = "0.4.23", features = ["zstd", "tokio"] }
+rustls = { version = "0.23.27", features = ["ring"] }
hurrycurry-protocol = { path = "../protocol" }
diff --git a/server/replaytool/src/main.rs b/server/replaytool/src/main.rs
index e9fa8003..a4b966f7 100644
--- a/server/replaytool/src/main.rs
+++ b/server/replaytool/src/main.rs
@@ -117,7 +117,7 @@ async fn main() -> anyhow::Result<()> {
info!("{addr} connected via ws");
sock.send(tokio_tungstenite::tungstenite::Message::Text(
- serde_json::to_string(&PacketC::ReplayStart).unwrap(),
+ serde_json::to_string(&PacketC::ReplayStart).unwrap().into(),
))
.await?;
'outer: while let Some(Ok(message)) = sock.next().await {
@@ -142,7 +142,8 @@ async fn main() -> anyhow::Result<()> {
},
error: true,
})
- .unwrap(),
+ .unwrap()
+ .into(),
))
.await?;
}
@@ -158,7 +159,9 @@ async fn main() -> anyhow::Result<()> {
while next_event.ts < time {
debug!("<- {:?}", next_event.packet);
sock.send(tokio_tungstenite::tungstenite::Message::Text(
- serde_json::to_string(&next_event.packet).unwrap(),
+ serde_json::to_string(&next_event.packet)
+ .unwrap()
+ .into(),
))
.await?;
diff --git a/server/src/entity/conveyor.rs b/server/src/entity/conveyor.rs
index 6177ba9c..4c50365d 100644
--- a/server/src/entity/conveyor.rs
+++ b/server/src/entity/conveyor.rs
@@ -65,7 +65,8 @@ impl Entity for Conveyor {
if self.from == self.to {
bail!("conveyor does ends in itself")
}
- let [Some(from), Some(to)] = c.game.tiles.get_many_mut([&self.from, &self.to]) else {
+ let [Some(from), Some(to)] = c.game.tiles.get_disjoint_mut([&self.from, &self.to])
+ else {
bail!("at least one conveyor end not on map");
};
diff --git a/server/src/entity/item_portal.rs b/server/src/entity/item_portal.rs
index 3ea33fa6..ef73e6ec 100644
--- a/server/src/entity/item_portal.rs
+++ b/server/src/entity/item_portal.rs
@@ -31,7 +31,7 @@ impl Entity for ItemPortal {
if self.from == self.to {
bail!("item portal ends in itself")
}
- let [Some(from), Some(to)] = c.game.tiles.get_many_mut([&self.from, &self.to]) else {
+ let [Some(from), Some(to)] = c.game.tiles.get_disjoint_mut([&self.from, &self.to]) else {
bail!("at least one item portal end not on map");
};
diff --git a/server/src/lib.rs b/server/src/lib.rs
index 9fba35ce..372b0b62 100644
--- a/server/src/lib.rs
+++ b/server/src/lib.rs
@@ -15,14 +15,7 @@
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-#![feature(
- if_let_guard,
- map_many_mut,
- let_chains,
- iterator_try_collect,
- trait_upcasting,
- stmt_expr_attributes
-)]
+#![feature(if_let_guard, let_chains, iterator_try_collect, stmt_expr_attributes)]
pub mod commands;
pub mod data;
pub mod entity;
diff --git a/server/src/main.rs b/server/src/main.rs
index b1dc503b..cc5bcb52 100644
--- a/server/src/main.rs
+++ b/server/src/main.rs
@@ -206,7 +206,7 @@ async fn run(args: Args) -> anyhow::Result<()> {
for p in init {
if let Err(e) = write
.send(tokio_tungstenite::tungstenite::Message::Text(
- serde_json::to_string(&p).unwrap(),
+ serde_json::to_string(&p).unwrap().into(),
))
.await
{
@@ -233,9 +233,13 @@ async fn run(args: Args) -> anyhow::Result<()> {
break;
};
let message = if supports_binary.load(Ordering::Relaxed) {
- Message::Binary(bincode::encode_to_vec(&packet, BINCODE_CONFIG).unwrap())
+ Message::Binary(
+ bincode::encode_to_vec(&packet, BINCODE_CONFIG)
+ .unwrap()
+ .into(),
+ )
} else {
- Message::Text(serde_json::to_string(&packet).unwrap())
+ Message::Text(serde_json::to_string(&packet).unwrap().into())
};
if let Err(e) = write.send(message).await {
warn!("WebSocket error: {e}");
diff --git a/server/src/scoreboard.rs b/server/src/scoreboard.rs
index f61b3001..f2fb86a2 100644
--- a/server/src/scoreboard.rs
+++ b/server/src/scoreboard.rs
@@ -42,7 +42,7 @@ pub struct ScoreboardEntry {
impl ScoreboardStore {
pub async fn load() -> Result<Self> {
let path =
- xdg::BaseDirectories::with_prefix("hurrycurry")?.place_data_file("scoreboards.json")?;
+ xdg::BaseDirectories::with_prefix("hurrycurry").place_data_file("scoreboards.json")?;
// TOCTOU because its easier that way
if !path.exists() {
ScoreboardStore::default().save().await?;
@@ -52,9 +52,9 @@ impl ScoreboardStore {
}
pub async fn save(&self) -> Result<()> {
let path =
- xdg::BaseDirectories::with_prefix("hurrycurry")?.place_data_file("scoreboards.json")?;
- let buffer_path = xdg::BaseDirectories::with_prefix("hurrycurry")?
- .place_data_file("scoreboards.json~")?;
+ xdg::BaseDirectories::with_prefix("hurrycurry").place_data_file("scoreboards.json")?;
+ let buffer_path =
+ xdg::BaseDirectories::with_prefix("hurrycurry").place_data_file("scoreboards.json~")?;
File::create(&buffer_path)
.await?
.write_all(serde_json::to_string(self)?.as_bytes())
diff --git a/server/src/server.rs b/server/src/server.rs
index f9342add..3823c0ca 100644
--- a/server/src/server.rs
+++ b/server/src/server.rs
@@ -531,7 +531,7 @@ impl Server {
return Err(tre!("s.error.self_interact"));
}
let [Some(other), Some(this)] =
- self.game.players.get_many_mut([&pid, &base_pid])
+ self.game.players.get_disjoint_mut([&pid, &base_pid])
else {
return Err(tre!("s.error.self_interact"));
};
@@ -677,7 +677,7 @@ impl Server {
.players_spatial_index
.query(pos1, 2., |p2, _pos2| {
if p1 != p2 {
- if let [Some(a), Some(b)] = self.game.players.get_many_mut([&p1, &p2]) {
+ if let [Some(a), Some(b)] = self.game.players.get_disjoint_mut([&p1, &p2]) {
a.movement.collide(&mut b.movement, dt)
}
}