Skip to content

Commit

Permalink
Finish means finish
Browse files Browse the repository at this point in the history
  • Loading branch information
ktff committed Nov 21, 2024
1 parent 0b4a946 commit 5b091e2
Showing 1 changed file with 3 additions and 13 deletions.
16 changes: 3 additions & 13 deletions wtransport/src/driver/streams/connect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,11 @@ use std::future::pending;

pub struct ConnectStream {
stream: Option<StreamSession>,
/// We've received CLOSE_WEBTRANSPORT_SESSION capsule
recv_close_ws: bool,
}

impl ConnectStream {
pub fn empty() -> Self {
Self {
stream: None,
recv_close_ws: false,
}
Self { stream: None }
}

pub fn is_empty(&self) -> bool {
Expand All @@ -33,7 +28,6 @@ impl ConnectStream {
}

pub async fn run(&mut self) -> DriverError {
assert!(!self.recv_close_ws);
let stream = match self.stream.as_mut() {
Some(stream) => stream,
None => pending().await,
Expand Down Expand Up @@ -64,7 +58,6 @@ impl ConnectStream {
Err(error_code) => return DriverError::Proto(error_code),
};

self.recv_close_ws = true;
DriverError::ApplicationClosed(ApplicationClose::new(
close_session.error_code(),
close_session
Expand Down Expand Up @@ -97,10 +90,7 @@ impl ConnectStream {
return;
};

// Handle termination procedure
if self.recv_close_ws {
// Finish our side
stream.finish().await;
}
// Finish our side
stream.finish().await;
}
}

0 comments on commit 5b091e2

Please sign in to comment.