Skip to content

Commit

Permalink
fix(smol): stop udp futures and reclaim resources for closed sockets
Browse files Browse the repository at this point in the history
  • Loading branch information
XOR-op committed Nov 24, 2024
1 parent bd169f4 commit 372de00
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion boltconn/src/transport/smol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -694,7 +694,8 @@ impl SmolStack {

pub fn purge_timeout_udp(&mut self) {
self.udp_conn.retain(|_port, task| {
if task.last_active.elapsed() > self.udp_timeout {
let socket = self.socket_set.get_mut::<SmolUdpSocket>(task.handle);
if !socket.is_open() || task.last_active.elapsed() > self.udp_timeout {
self.socket_set.remove(task.handle);
task.abort_handle.cancel();
false
Expand Down

0 comments on commit 372de00

Please sign in to comment.