Skip to content

Commit a1299ae

Browse files
committed
feat: begin working on compression
1 parent 8e1c52a commit a1299ae

File tree

4 files changed

+29
-4
lines changed

4 files changed

+29
-4
lines changed

Cargo.lock

Lines changed: 23 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ clap = { version = "4.5.20", features = ["derive"] }
3232
color-eyre = "0.6.3"
3333
fastanvil = { git = "https://github.com/owengage/fastnbt.git" }
3434
fastnbt = { git = "https://github.com/owengage/fastnbt.git" }
35+
flate2 = { version = "1.0.35", default-features = false, features = ["zlib-ng"] }
3536
rand = "0.8.5"
3637
rayon = "1.10.0"
3738
serde = { version = "1.0.213", features = ["derive"] }

flake.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@
8080
cargoLock.outputHashes."fastnbt-2.5.0" = "E4WI6SZgkjqUOtbfXfKGfpFH7btEh5V0KpMXSIsuh08=";
8181
inherit buildType;
8282
dontStrip = buildType == "debug";
83-
buildInputs = with pkgs; [pkg-config openssl];
83+
buildInputs = with pkgs; [pkg-config openssl cmake];
8484
};
8585
in {
8686
default = mkCrawlspace "debug";

src/net/io.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,18 @@ use color_eyre::eyre::{Context, Result};
2424
use tokio::{
2525
io::{AsyncReadExt, AsyncWriteExt},
2626
net::TcpStream,
27+
sync::RwLock,
2728
};
2829

29-
use crate::protocol::{self, ClientboundPacket, Frame, ServerboundPacket};
30+
use crate::protocol::{self, datatypes::VarInt, ClientboundPacket, Frame, ServerboundPacket};
3031

3132
#[derive(Debug)]
3233
pub struct NetIo {
3334
stream: TcpStream,
3435
frame: Frame,
3536
decoder: protocol::Decoder,
3637
encoder: protocol::Encoder,
38+
compression: RwLock<Option<VarInt>>,
3739
}
3840

3941
const BUF_SIZE: usize = 4096;
@@ -58,6 +60,7 @@ impl NetIo {
5860
},
5961
decoder: protocol::Decoder::new(),
6062
encoder: protocol::Encoder::new(),
63+
compression: RwLock::new(None),
6164
}
6265
}
6366

0 commit comments

Comments
 (0)