Skip to content

Commit

Permalink
fix rejection
Browse files Browse the repository at this point in the history
  • Loading branch information
Robert Ream authored and robertream committed May 27, 2024
1 parent 34b6970 commit e806816
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 7 deletions.
7 changes: 4 additions & 3 deletions srt-protocol/src/protocol/pending_connection/listen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ impl Listen {
}

pub fn handle_timer(&self, _now: Instant) -> ConnectionResult {
ConnectionResult::NoAction
NoAction
}

fn handle_control_packets(
Expand Down Expand Up @@ -299,13 +299,14 @@ impl Listen {
}

fn make_rejection(
&self,
&mut self,
response_to: &HandshakeControlInfo,
from: SocketAddr,
timestamp: TimeStamp,
r: ConnectionReject,
) -> ConnectionResult {
ConnectionResult::Reject(
self.state = InductionWait;
Reject(
Some((
ControlPacket {
timestamp,
Expand Down
4 changes: 2 additions & 2 deletions srt-protocol/src/protocol/pending_connection/rendezvous.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,12 +166,12 @@ impl Rendezvous {
// }

fn make_rejection(
&self,
&mut self,
response_to: &HandshakeControlInfo,
timestamp: TimeStamp,
r: ConnectionReject,
) -> ConnectionResult {
ConnectionResult::Reject(
Reject(
Some((
ControlPacket {
timestamp,
Expand Down
7 changes: 6 additions & 1 deletion srt-tokio/src/socket/listen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,12 @@ pub async fn bind_with(
NotHandled(e) => {
warn!("{:?}", e);
}
Reject(_, _) => todo!(),
Reject(packet, e) => {
warn!("{:?}", e);
if let Some(packet) = packet {
let _ = socket.send(packet).await?;
}
}
Connected(p, connection) => {
if let Some(packet) = p {
let _ = socket.send(packet).await?;
Expand Down
8 changes: 7 additions & 1 deletion srt-tokio/src/socket/rendezvous.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,13 @@ pub async fn bind_with(
NotHandled(e) => {
warn!("rendezvous {:?} error: {}", socket_id, e);
}
Reject(_, _) => todo!(),
Reject(p, e) => {
warn!("rendezvous {:?} error: {}", socket_id, e);
if let Some(packet) = p {
let _ = socket.send(packet).await?;
}
return Err(io::Error::new(io::ErrorKind::ConnectionRefused, e));
}
Connected(p, connection) => {
if let Some(packet) = p {
let _ = socket.send(packet).await?;
Expand Down

0 comments on commit e806816

Please sign in to comment.