1
0

adding more packet info getter

This commit is contained in:
EAimTY 2023-03-04 19:45:25 +09:00
parent f7e55f2b0b
commit 7a94058e36

View File

@ -132,7 +132,7 @@ impl Connection<side::Client> {
let mut send = self.conn.open_uni().await?;
model.header().async_marshal(&mut send).await?;
send.close().await?;
send.close().await?; // stuck here
Ok(())
}
@ -479,6 +479,21 @@ impl Packet {
self.model.assoc_id()
}
/// Returns the packet ID
pub fn pkt_id(&self) -> u16 {
self.model.pkt_id()
}
/// Returns the fragment ID
pub fn frag_id(&self) -> u8 {
self.model.frag_id()
}
/// Returns the total number of fragments
pub fn frag_total(&self) -> u8 {
self.model.frag_total()
}
/// Accepts the packet payload. If the packet is fragmented and not yet fully assembled, `Ok(None)` is returned.
pub async fn accept(self) -> Result<Option<(Bytes, Address, u16)>, Error> {
let pkt = match self.src {