continue working on endpoints and reenabled reading packet options

This commit is contained in:
DJMrTV 2025-01-19 20:33:15 +01:00
commit d6fbf79ded
2 changed files with 13 additions and 4 deletions

View file

@ -3,7 +3,7 @@ use std::net::UdpSocket;
use std::sync::{Arc, RwLock};
use log::{error, info};
use rand::random;
use crate::prudp::packet::{flags, PRUDPPacket, VirtualPort};
use crate::prudp::packet::{flags, PRUDPPacket, types, VirtualPort};
use crate::prudp::sockaddr::PRUDPSockAddr;
#[derive(Debug)]
@ -60,7 +60,7 @@ impl Endpoint{
return;
};
if ((packet.header.types_and_flags.get_flags() & flags::NEED_ACK) != 0) ||
if //((packet.header.types_and_flags.get_flags() & flags::NEED_ACK) != 0) ||
((packet.header.types_and_flags.get_flags() & flags::ACK) != 0) ||
((packet.header.types_and_flags.get_flags() & flags::RELIABLE) != 0) ||
((packet.header.types_and_flags.get_flags() & flags::MULTI_ACK) != 0) {
@ -70,7 +70,12 @@ impl Endpoint{
}
match packet.header.types_and_flags.get_types() {
types::SYN => {
}
_ => unimplemented!()
}
}

View file

@ -59,6 +59,10 @@ pub mod flags{
}
pub mod types {
pub const SYN: u8 = 0x0;
}
impl Debug for TypesFlags{
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
let stream_type = self.get_types();
@ -196,7 +200,7 @@ impl PRUDPPacket{
//no clue whats up with options but they are broken
/*let mut packet_specific_data_cursor = Cursor::new(&packet_specific_buffer);
let mut packet_specific_data_cursor = Cursor::new(&packet_specific_buffer);
loop {
@ -226,7 +230,7 @@ impl PRUDPPacket{
if packet_specific_data_cursor.read_exact(&mut option_data).is_err(){
break;
}
}*/
}
let mut payload = vec![0u8; header.payload_size as usize];