Skip to content

Commit 16d1b8d

Browse files
refactor: Renamed ping response
1 parent 34f7a69 commit 16d1b8d

File tree

5 files changed

+9
-9
lines changed

5 files changed

+9
-9
lines changed

src/packets/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@ pub mod encryption_request;
33
pub mod encryption_response;
44
pub mod handshake;
55
pub mod login_start;
6-
pub mod ping;
6+
pub mod pong;
77
pub mod status;

src/packets/ping.rs renamed to src/packets/pong.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ use crate::byte_buf_utils::{add_size, write_varint};
22
use anyhow::Result;
33
use bytes::{BufMut, BytesMut};
44

5-
pub struct PingPacket {
5+
pub struct PongPacket {
66
pub payload: i64,
77
}
88

9-
impl PingPacket {
9+
impl PongPacket {
1010
/**
1111
Build packet for sending over network
1212
*/

src/responses/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
pub mod disconnect;
22
pub mod encryption;
3-
pub mod ping;
3+
pub mod pong;
44
pub mod status;

src/responses/ping.rs renamed to src/responses/pong.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
use anyhow::Result;
22

3-
use crate::{packets::ping::PingPacket, server::MinecraftServer};
3+
use crate::{packets::pong::PongPacket, server::MinecraftServer};
44
use tokio::io::AsyncWriteExt;
55

66
impl MinecraftServer {
77
/**
8-
Send ping response
8+
Send pong response
99
*/
10-
pub async fn send_ping(&mut self, payload: i64) -> Result<()> {
11-
let packet = PingPacket { payload };
10+
pub async fn send_pong(&mut self, payload: i64) -> Result<()> {
11+
let packet = PongPacket { payload };
1212

1313
self.stream.writable().await?;
1414
self.stream.write_all(&packet.build()?).await?;

src/server.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ impl MinecraftServer {
145145
NextStateEnum::Status => {
146146
// Handle ping request
147147
let payload = self.buffer.get_i64();
148-
self.send_ping(payload).await?
148+
self.send_pong(payload).await?
149149
}
150150
NextStateEnum::Login => {
151151
debug!("Received encryption response");

0 commit comments

Comments
 (0)