Skip to content

Commit

Permalink
web-socket-web: check thread guard on drop
Browse files Browse the repository at this point in the history
  • Loading branch information
surban committed Jan 25, 2025
1 parent 285259d commit 6477a61
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions aggligator-transport-websocket-web/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,12 @@ where
}
}

impl<F> Drop for LocalFuture<F> {
fn drop(&mut self) {
self.thread_guard.check();
}
}

struct WebSocketSink {
sender: WebSocketSender,
thread_guard: ThreadGuard,
Expand Down Expand Up @@ -280,6 +286,12 @@ impl Sink<Bytes> for WebSocketSink {
}
}

impl Drop for WebSocketSink {
fn drop(&mut self) {
self.thread_guard.check();
}
}

struct WebSocketStream {
receiver: WebSocketReceiver,
thread_guard: ThreadGuard,
Expand All @@ -305,3 +317,9 @@ impl Stream for WebSocketStream {
Poll::Ready(data_opt)
}
}

impl Drop for WebSocketStream {
fn drop(&mut self) {
self.thread_guard.check();
}
}

0 comments on commit 6477a61

Please sign in to comment.