feat(secure): a bunch of stuff
This commit is contained in:
parent
4f26aae1d7
commit
81f7a0a738
15 changed files with 480 additions and 49 deletions
|
|
@ -9,7 +9,7 @@ use crate::rmc::message::RMCMessage;
|
|||
use crate::rmc::response::{RMCResponse, RMCResponseResult, send_response};
|
||||
use crate::rmc::response::ErrorCode::Core_NotImplemented;
|
||||
|
||||
type ContainedProtocolList = Box<[Box<dyn for<'a> Fn(&'a RMCMessage) -> Pin<Box<dyn Future<Output = Option<RMCResponse>> + Send + 'a>> + Send + Sync>]>;
|
||||
type ContainedProtocolList = Box<[Box<dyn for<'a> Fn(&'a RMCMessage, &'a mut ConnectionData) -> Pin<Box<dyn Future<Output = Option<RMCResponse>> + Send + 'a>> + Send + Sync>]>;
|
||||
|
||||
pub struct RMCProtocolServer(ContainedProtocolList);
|
||||
|
||||
|
|
@ -27,12 +27,14 @@ impl RMCProtocolServer{
|
|||
println!("recieved rmc message: {{ protocol: {}, method: {}}}", rmc.protocol_id, rmc.method_id);
|
||||
|
||||
for proto in &self.0 {
|
||||
if let Some(response) = proto(&rmc).await {
|
||||
if let Some(response) = proto(&rmc, connection).await {
|
||||
send_response(&packet, &socket, connection, response).await;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
error!("tried to send message to unimplemented protocol {} with method id {}", rmc.protocol_id, rmc.method_id);
|
||||
|
||||
send_response(&packet, &socket, connection, RMCResponse{
|
||||
protocol_id: rmc.protocol_id as u8,
|
||||
response_result: RMCResponseResult::Error {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue