Skip to content

Commit

Permalink
fix(sip-core): fix build failure after stun-types changes
Browse files Browse the repository at this point in the history
  • Loading branch information
kbalt committed Jan 10, 2025
1 parent c497afd commit ece0e38
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion crates/sip-core/src/transport/parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ pub fn parse_complete(parser: Parser, bytes: &[u8]) -> Result<CompleteItem, Erro
}

fn parse_complete_stun(bytes: &[u8]) -> Result<CompleteItem, Error> {
let msg = match Message::parse(bytes.into()) {
let msg = match Message::parse(bytes) {
Ok(msg) => msg,
Err(e) => {
log::warn!("failed to parse complete stun message, {}", e);
Expand Down
2 changes: 1 addition & 1 deletion crates/sip-core/src/transport/resolver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ async fn resolve_a_records(
fn filter_no_records<T>(e: Result<T, ResolveError>) -> Result<Option<T>, ResolveError> {
match e {
Ok(t) => Ok(Some(t)),
Err(e) if e.proto().map_or(false, |p| p.is_no_records_found()) => Ok(None),
Err(e) if e.proto().is_some_and(|p| p.is_no_records_found()) => Ok(None),
Err(e) => Err(e),
}
}
4 changes: 2 additions & 2 deletions crates/sip-core/src/transport/stun_user.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use std::io;
use std::net::SocketAddr;
use stun::{IncomingMessage, StunEndpointUser};
use stun_types::attributes::{MappedAddress, Software, XorMappedAddress};
use stun_types::{transaction_id, Class, MessageBuilder, Method};
use stun_types::{Class, MessageBuilder, Method, TransactionId};

pub struct StunUser;

Expand Down Expand Up @@ -42,7 +42,7 @@ impl Transports {
return Ok(transport.sent_by());
}

let tsx_id = transaction_id();
let tsx_id = TransactionId::random();

let mut msg = MessageBuilder::new(Class::Request, Method::Binding, tsx_id);
msg.add_attr(&Software::new("ezk")).unwrap();
Expand Down

0 comments on commit ece0e38

Please sign in to comment.