Skip to content

Commit

Permalink
Only clone when really needed
Browse files Browse the repository at this point in the history
  • Loading branch information
flub committed Nov 27, 2024
1 parent e2f55dd commit f5bf54d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion iroh-relay/src/server/client_conn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -388,10 +388,11 @@ impl Stream for RateLimitedRelayedStream {
mut self: Pin<&mut Self>,
cx: &mut std::task::Context<'_>,
) -> Poll<Option<Self::Item>> {
let Some(limiter) = self.limiter.clone() else {
let Some(ref limiter) = self.limiter else {
// If there is no rate-limiter directly poll the inner.
return Pin::new(&mut self.inner).poll_next(cx);
};
let limiter = limiter.clone();
loop {
match &mut self.state {
State::Ready => {
Expand Down

0 comments on commit f5bf54d

Please sign in to comment.