diff --git a/rtc b/rtc index bc9fae8..2b95c79 160000 --- a/rtc +++ b/rtc @@ -1 +1 @@ -Subproject commit bc9fae8f33f2f382de2cb78c7ac7a89b6517d054 +Subproject commit 2b95c79bd23db8e65c0839678f36402db005cda3 diff --git a/src/handlers/data/mod.rs b/src/handlers/data/mod.rs index 11ca21f..c3483b1 100644 --- a/src/handlers/data/mod.rs +++ b/src/handlers/data/mod.rs @@ -5,7 +5,7 @@ use crate::messages::{ use data::message::{message_channel_ack::*, message_channel_open::*, message_type::*, *}; use log::{debug, error}; use retty::channel::{Handler, InboundContext, InboundHandler, OutboundContext, OutboundHandler}; -use shared::error::{Error, Result}; +use shared::error::Result; use shared::marshal::*; #[derive(Default)] @@ -66,7 +66,7 @@ impl InboundHandler for DataChannelInbound { } else { Ok((None, None)) } - } else if message.data_message_type == DataChannelMessageType::Binary { + } else { Ok(( Some(ApplicationMessage { association_handle: message.association_handle, @@ -75,8 +75,6 @@ impl InboundHandler for DataChannelInbound { }), None, )) - } else { - Err(Error::UnknownProtocol) } }; diff --git a/src/handlers/dtls/mod.rs b/src/handlers/dtls/mod.rs index f2ac07b..9fd127f 100644 --- a/src/handlers/dtls/mod.rs +++ b/src/handlers/dtls/mod.rs @@ -159,6 +159,7 @@ impl OutboundHandler for DtlsOutbound { dtls_endpoint.write(msg.transport.peer_addr, &dtls_message) }; if let Err(err) = try_write() { + error!("try_write with error {}", err); ctx.fire_write_exception(Box::new(err)); } handle_outgoing(ctx, &self.dtls_endpoint, msg.transport.local_addr); diff --git a/src/handlers/sctp/mod.rs b/src/handlers/sctp/mod.rs index a02e7fc..d3edcf0 100644 --- a/src/handlers/sctp/mod.rs +++ b/src/handlers/sctp/mod.rs @@ -56,7 +56,14 @@ impl SctpHandler { sctp_endpoint: Rc::clone(&sctp_endpoint), transmits: VecDeque::new(), - internal_buffer: vec![0u8; 1500], + internal_buffer: vec![ + 0u8; + server_states + .server_config() + .sctp_server_config + .transport + .max_message_size() as usize + ], }, sctp_outbound: SctpOutbound { server_states, @@ -240,13 +247,14 @@ impl OutboundHandler for SctpOutbound { msg.transport.peer_addr, message ); let mut try_write = || -> Result<()> { - let max_payload_size = { - self.sctp_endpoint - .borrow() - .endpoint_config() - .get_max_payload_size() as usize + let max_message_size = { + self.server_states + .server_config() + .sctp_server_config + .transport + .max_message_size() as usize as usize }; - if message.payload.len() > max_payload_size { + if message.payload.len() > max_message_size { return Err(Error::ErrOutboundPacketTooLarge); } @@ -288,6 +296,7 @@ impl OutboundHandler for SctpOutbound { Ok(()) }; if let Err(err) = try_write() { + error!("try_write with error {}", err); ctx.fire_write_exception(Box::new(err)); } handle_outgoing(ctx, &mut self.transmits, msg.transport.local_addr);