Skip to content

Commit cf6544b

Browse files
committed
Implement read_packet and send_packet
1 parent b52f29c commit cf6544b

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/lib.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ impl Connection {
6060
todo!();
6161
}
6262

63-
pub async fn connect(
63+
pub(crate) async fn connect(
6464
stream: TcpStream,
6565
addr: SocketAddr,
6666
host_key: Arc<Ed25519KeyPair>,
@@ -69,12 +69,12 @@ impl Connection {
6969
todo!()
7070
}
7171

72-
pub async fn recv_packet(&mut self) -> anyhow::Result<Packet<'_>> {
73-
todo!()
72+
pub(crate) async fn recv_packet(&mut self) -> anyhow::Result<Packet<'_>> {
73+
Ok(self.stream_read.read_packet().await?)
7474
}
7575

76-
pub async fn send_packet(&mut self, packet: impl Encode) -> anyhow::Result<()> {
77-
todo!()
76+
pub(crate) async fn send_packet(&mut self, payload: &impl Encode) -> anyhow::Result<()> {
77+
Ok(self.stream_write.write_packet(payload, |_| {}).await?)
7878
}
7979
}
8080

0 commit comments

Comments
 (0)