diff --git a/src/packet.rs b/src/packet.rs index 26aafbc..398ce14 100644 --- a/src/packet.rs +++ b/src/packet.rs @@ -116,7 +116,7 @@ impl<'a> Packet<'a> { buf.put_u16(block_id); } - pub(crate) fn into_bytes(self) -> Bytes { + pub(crate) fn to_bytes(&self) -> Bytes { let mut buf = BytesMut::new(); self.encode(&mut buf); buf.freeze() diff --git a/src/server/server.rs b/src/server/server.rs index 0fcef06..3ddc30f 100644 --- a/src/server/server.rs +++ b/src/server/server.rs @@ -150,7 +150,7 @@ async fn send_error(error: Error, peer: SocketAddr) -> Result<()> { let addr: SocketAddr = "0.0.0.0:0".parse().unwrap(); let socket = Async::::bind(addr).map_err(Error::Bind)?; - let data = Packet::Error(error.into()).into_bytes(); + let data = Packet::Error(error.into()).to_bytes(); socket.send_to(&data[..], peer).await?; Ok(())