some changes?
This commit is contained in:
parent
59d815123e
commit
d9c5f13b42
@ -77,12 +77,12 @@ impl MinecraftConnection<TcpStream> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Close TcpStream
|
/// Close TcpStream
|
||||||
pub fn close(&mut self) {
|
pub fn close(&self) {
|
||||||
let _ = self.stream.shutdown(std::net::Shutdown::Both);
|
let _ = self.stream.shutdown(std::net::Shutdown::Both);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Try clone MinecraftConnection with compression and stream
|
/// Try clone MinecraftConnection with compression and stream
|
||||||
pub fn try_clone(&mut self) -> Result<MinecraftConnection<TcpStream>, ProtocolError> {
|
pub fn try_clone(&self) -> Result<MinecraftConnection<TcpStream>, ProtocolError> {
|
||||||
match self.stream.try_clone() {
|
match self.stream.try_clone() {
|
||||||
Ok(stream) => Ok(MinecraftConnection {
|
Ok(stream) => Ok(MinecraftConnection {
|
||||||
stream,
|
stream,
|
||||||
@ -278,7 +278,7 @@ pub fn write_packet_atomic<T: Write>(
|
|||||||
|
|
||||||
let mut data_buf = ByteBuffer::new();
|
let mut data_buf = ByteBuffer::new();
|
||||||
data_buf.write_u8_varint(packet.id())?;
|
data_buf.write_u8_varint(packet.id())?;
|
||||||
data_buf.write_buffer(packet.buffer_ref())?;
|
data_buf.write_buffer(packet.buffer())?;
|
||||||
|
|
||||||
let compress_threshold = compression.load(ordering);
|
let compress_threshold = compression.load(ordering);
|
||||||
|
|
||||||
|
@ -67,12 +67,12 @@ impl Packet {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Get mutable reference of buffer
|
/// Get mutable reference of buffer
|
||||||
pub fn buffer(&mut self) -> &mut ByteBuffer {
|
pub fn buffer_mut(&mut self) -> &mut ByteBuffer {
|
||||||
&mut self.buffer
|
&mut self.buffer
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Get immutable reference of buffer
|
/// Get immutable reference of buffer
|
||||||
pub fn buffer_ref(&self) -> &ByteBuffer {
|
pub fn buffer(&self) -> &ByteBuffer {
|
||||||
&self.buffer
|
&self.buffer
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user