fix: properly read Status Request

kity
Skye 9 months ago
parent fa99261efc
commit 5d36e5a9ba
Signed by: me
GPG Key ID: 0104BC05F41B77B8

@ -273,6 +273,12 @@ async fn politely_disconnect(
) -> anyhow::Result<()> { ) -> anyhow::Result<()> {
match handshake.next_state { match handshake.next_state {
netty::HandshakeType::Status => { netty::HandshakeType::Status => {
let packet = netty::read_packet(&mut connection).await?;
let mut packet = packet.as_slice();
let id = packet.read_varint()?;
if id != 0 {
return Err(anyhow!("Packet isn't a Status Request(0x00), but {:#04x}", id));
}
let mut buf = vec![]; let mut buf = vec![];
buf.write_varint(0).await?; buf.write_varint(0).await?;
buf.write_string(include_str!("./serverlistping_response.json")) buf.write_string(include_str!("./serverlistping_response.json"))

Loading…
Cancel
Save