Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/transport/connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -347,9 +347,13 @@ impl SipConnection {
typed_via.params.push(Param::Transport(transport));
}

let received_str = match addr {
SocketAddr::V6(_) => format!("[{}]", received.host),
_ => received.host.to_string(),
};
*via = typed_via
.with_param(Param::Received(rsip::param::Received::new(
received.host.to_string(),
received_str,
)))
.with_param(Param::Other(
rsip::param::OtherParam::new("rport"),
Expand Down
9 changes: 5 additions & 4 deletions src/transport/tcp_listener.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ impl TcpListenerConnection {
transport_layer_inner: TransportLayerInnerRef,
) -> Result<()> {
let listener = TcpListener::bind(self.inner.local_addr.get_socketaddr()?).await?;
let listener_local_addr = SipAddr {
r#type: Some(rsip::transport::Transport::Tcp),
addr: listener.local_addr().unwrap().into(),
};
tokio::spawn(async move {
loop {
let (stream, remote_addr) = match listener.accept().await {
Expand All @@ -49,10 +53,7 @@ impl TcpListenerConnection {
debug!(remote = %remote_addr, "tcp connection rejected by whitelist");
continue;
}
let local_addr = SipAddr {
r#type: Some(rsip::transport::Transport::Tcp),
addr: remote_addr.into(),
};
let local_addr = listener_local_addr.clone();
let tcp_connection = match TcpConnection::from_stream(
stream,
local_addr.clone(),
Expand Down
5 changes: 4 additions & 1 deletion src/transport/transport_layer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -431,9 +431,12 @@ impl TransportLayerInner {
}
select! {
_ = sub_token.cancelled() => { }
_ = async {
result = async {
transport.serve_loop(sender_clone.clone()).await
} => {
if let Err(e) = result {
warn!(addr=%transport.get_addr(), error = %e, "serve_loop error");
}
}
}
info!(addr=%transport.get_addr(), "transport serve_loop exited");
Expand Down
Loading