create separate types per command

This commit is contained in:
Vinzenz Schroeter 2025-06-16 11:32:12 +02:00
parent c29482ac56
commit bffc905261
19 changed files with 306 additions and 200 deletions

View file

@ -1,4 +1,4 @@
use crate::{commands::command::Command, errors::ServicePointError};
use crate::{errors::ServicePointError, packet::Packet};
use servicepoint::UdpSocketExt;
use std::{net::UdpSocket, sync::Arc};
@ -18,9 +18,12 @@ impl Connection {
})
}
pub fn send(&self, command: Arc<Command>) -> Result<(), ServicePointError> {
pub fn send_packet(
&self,
command: Arc<Packet>,
) -> Result<(), ServicePointError> {
self.actual
.send_command(command.actual.read().unwrap().clone())
.send_command(command.read().clone())
.ok_or_else(|| ServicePointError::IoError {
error: "send failed".to_string(),
})