fix warnings
Some checks failed
Build and Test / friends (push) Successful in 3m13s
Build and Test / splatoon (push) Failing after 4m27s

This commit is contained in:
Maple 2026-04-26 13:15:56 +02:00
commit a88f1898a5
24 changed files with 148 additions and 213 deletions

View file

@ -5,7 +5,7 @@ use crate::crypto::Crypto;
pub struct Insecure;
impl Crypto for Insecure {
fn new_connection(&self, data: &[u8]) -> Option<(PID, Vec<u8>)> {
fn new_connection(&self, _data: &[u8]) -> Option<(PID, Vec<u8>)> {
Some((100, vec![]))
}
fn new() -> Self {

View file

@ -17,7 +17,7 @@ use rnex_core::{
types_flags::{
TypesFlags,
flags::{ACK, NEED_ACK, RELIABLE},
types::{CONNECT, DATA, DISCONNECT, SYN},
types::{CONNECT, DATA, DISCONNECT, PING, SYN},
},
virtual_port::VirtualPort,
},
@ -26,20 +26,20 @@ use rnex_core::{
use tokio::net::{TcpListener, TcpStream};
use tokio_tungstenite::{
WebSocketStream,
tungstenite::{
Bytes, Message, client::IntoClientRequest, http::header::ACCESS_CONTROL_REQUEST_METHOD,
},
tungstenite::{Bytes, Message},
};
struct ConnectionState {
param: Arc<ProxyStartupParam>,
active: bool,
websocket: WebSocketStream<TcpStream>,
#[allow(dead_code)]
pid: PID,
backend_conn: SplittableBufferConnection,
addr: PRUDPSockAddr,
incoming_reliable: HashMap<u16, LitePacket<Bytes>>,
client_reliable_counter: u16,
#[allow(dead_code)]
server_reliable_counter: u16,
}
@ -71,10 +71,16 @@ impl ConnectionState {
);
let data: Bytes = data.into();
if header.types_flags.get_types() == DISCONNECT {
self.websocket.send(Message::Binary(data.clone())).await;
self.websocket.send(Message::Binary(data.clone())).await;
self.websocket
.send(Message::Binary(data.clone()))
.await
.ok();
self.websocket
.send(Message::Binary(data.clone()))
.await
.ok();
}
self.websocket.send(Message::Binary(data)).await;
self.websocket.send(Message::Binary(data)).await.ok();
}
if (header.types_flags.get_flags() & ACK) != 0 {
@ -111,6 +117,7 @@ impl ConnectionState {
}
}
}
#[allow(dead_code)]
pub async fn process_reliable(&mut self) {
while let Some(v) = self.incoming_reliable.remove(&self.client_reliable_counter) {
self.handle_incoming_prudp(v, true).await;
@ -131,7 +138,7 @@ impl ConnectionState {
}
}
}
v = self.backend_conn.recv() => {
_ = self.backend_conn.recv() => {
}
}
@ -197,7 +204,7 @@ pub async fn websocket_thread_unconnected<C: Crypto>(
],
&[],
);
websocket.send(Message::Binary(data.into())).await;
websocket.send(Message::Binary(data.into())).await.ok();
}
CONNECT => {
let Some(supported) = packet.packet_specific_iter() else {
@ -242,7 +249,7 @@ pub async fn websocket_thread_unconnected<C: Crypto>(
],
&data,
);
websocket.send(Message::Binary(data.into())).await;
websocket.send(Message::Binary(data.into())).await.ok();
let addr = PRUDPSockAddr::new(
addr,

View file

@ -3,8 +3,7 @@ use std::{
io::{self, Cursor, Read, Write},
};
use bytemuck::{Pod, Zeroable, bytes_of};
use futures_util::Stream;
use bytemuck::{Pod, Zeroable, bytes_of_mut};
use rnex_core::prudp::types_flags::TypesFlags;
use v_byte_helpers::{IS_BIG_ENDIAN, ReadExtensions};
@ -30,10 +29,10 @@ pub enum PacketSpecificData {
impl PacketSpecificData {
fn consume(reader: &mut impl Read) -> io::Result<Self> {
let mut option_id = 0;
reader.read_exact(&mut [option_id])?;
let mut size = 0;
reader.read_exact(&mut [size])?;
let mut option_id = 0u8;
reader.read_exact(bytes_of_mut(&mut option_id))?;
let mut size = 0u8;
reader.read_exact(bytes_of_mut(&mut size))?;
match option_id {
0 => {
@ -156,7 +155,7 @@ impl<T: AsRef<[u8]>> LitePacket<T> {
.get_mut(size_of::<LiteHeader>()..size_of::<LiteHeader>() + len as usize)
}
pub fn packet_specific_iter(&self) -> Option<PacketSpecificIter> {
pub fn packet_specific_iter<'a>(&'a self) -> Option<PacketSpecificIter<'a>> {
self.packet_specific_raw()
.map(Cursor::new)
.map(PacketSpecificIter)