Compare commits
2 commits
c70527ded5
...
ec71d35710
| Author | SHA1 | Date | |
|---|---|---|---|
| ec71d35710 | |||
| 17d6c315af |
1 changed files with 3 additions and 1 deletions
|
|
@ -42,12 +42,14 @@ pub async fn complete_status_request(
|
||||||
/// Disconnects the client.
|
/// Disconnects the client.
|
||||||
///
|
///
|
||||||
/// It works if the client is in the login state, and it
|
/// It works if the client is in the login state, and it
|
||||||
/// has *already* and *only* sent the **handshake** and **login_start** packet.
|
/// has *already* and *only* sent the handshake packet.
|
||||||
#[tracing::instrument(skip(client_stream))]
|
#[tracing::instrument(skip(client_stream))]
|
||||||
pub async fn send_disconnect(
|
pub async fn send_disconnect(
|
||||||
client_stream: &mut TcpStream,
|
client_stream: &mut TcpStream,
|
||||||
reason: &str,
|
reason: &str,
|
||||||
) -> Result<(), OpaqueError> {
|
) -> Result<(), OpaqueError> {
|
||||||
|
let _client_packet = Packet::parse(client_stream).await?;
|
||||||
|
|
||||||
let disconnect_packet =
|
let disconnect_packet =
|
||||||
crate::packets::clientbound::login::Disconnect::set_reason(reason.to_owned())
|
crate::packets::clientbound::login::Disconnect::set_reason(reason.to_owned())
|
||||||
.await
|
.await
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue