aboutsummaryrefslogtreecommitdiff
path: root/azalea-protocol/src/write.rs
diff options
context:
space:
mode:
authormat <github@matdoes.dev>2021-12-16 17:51:05 -0600
committermat <github@matdoes.dev>2021-12-16 17:51:05 -0600
commit227ba5511d50af8c7c46a47e09db7f55a0ed84b7 (patch)
tree1067828ee2082e0f073a4d16b201b2888c55b6e8 /azalea-protocol/src/write.rs
parent999116ed7c5edf113e12aae150c2e23974d539dc (diff)
downloadazalea-drasl-227ba5511d50af8c7c46a47e09db7f55a0ed84b7.tar.xz
add a few more login packets
Diffstat (limited to 'azalea-protocol/src/write.rs')
-rw-r--r--azalea-protocol/src/write.rs8
1 files changed, 6 insertions, 2 deletions
diff --git a/azalea-protocol/src/write.rs b/azalea-protocol/src/write.rs
index 3d8540eb..bf9fd0aa 100644
--- a/azalea-protocol/src/write.rs
+++ b/azalea-protocol/src/write.rs
@@ -10,7 +10,9 @@ pub async fn write_packet(packet: impl ProtocolPacket, stream: &mut TcpStream) {
// write the packet id
let mut id_and_data_buf = vec![];
- id_and_data_buf.write_varint(packet.id() as i32);
+ id_and_data_buf
+ .write_varint(packet.id() as i32)
+ .expect("Writing packet id failed");
packet.write(&mut id_and_data_buf);
// write the packet data
@@ -18,7 +20,9 @@ pub async fn write_packet(packet: impl ProtocolPacket, stream: &mut TcpStream) {
// make a new buffer that has the length at the beginning
// and id+data at the end
let mut complete_buf: Vec<u8> = Vec::new();
- complete_buf.write_varint(id_and_data_buf.len() as i32);
+ complete_buf
+ .write_varint(id_and_data_buf.len() as i32)
+ .expect("Writing packet length failed");
complete_buf.append(&mut id_and_data_buf);
// finally, write and flush to the stream