[dev-dependencies]
pretty-hex = "0.3.0"
-tokio = { features = ["rt-multi-thread"] }
+tokio = { version = "1.23.0", features = ["rt-multi-thread"] }
let sock = Arc::new(net::UdpSocket::bind("0.0.0.0:0").await?);
sock.connect(addr).await?;
- Ok(new(
+ new(
PeerID::Srv as u16,
PeerID::Nil as u16,
Sender {
},
Receiver { sock },
)
- .await?)
+ .await
}
write!(f, "rudp: ")?;
match self {
- IoError(err) => write!(f, "IO error: {}", err),
+ IoError(err) => write!(f, "IO error: {err}"),
InvalidProtoId(id) => write!(f, "invalid protocol ID: {id}"),
InvalidChannel(ch) => write!(f, "invalid channel: {ch}"),
InvalidType(tp) => write!(f, "invalid type: {tp}"),
self.pkt_tx.send(Err(RemoteDisco(to))).ok();
}
+ #[allow(clippy::single_match)]
match e {
// anon5's mt notifies the peer on timeout, C++ MT does not
LocalDisco /*| RemoteDisco(true)*/ => drop(
}
impl<S: UdpSender> RudpShare<S> {
+ #[allow(clippy::unused_io_amount)]
pub async fn send(&self, tp: PktType, pkt: Pkt<&[u8]>) -> AckResult {
let mut buf = Vec::with_capacity(4 + 2 + 1 + 1 + 2 + 1 + pkt.data.len());
buf.write_u32::<BigEndian>(PROTO_ID)?;
buf.write_u16::<BigEndian>(*self.remote_id.read().await)?;
- buf.write_u8(pkt.chan as u8)?;
+ buf.write_u8(pkt.chan)?;
let mut chan = self.chans[pkt.chan as usize].lock().await;
let seqnum = chan.seqnum;