nal: Prevent pushing duplicate handles for the same TcpSocket
This commit is contained in:
parent
66c3aa534f
commit
6de19f43cc
|
@ -297,7 +297,10 @@ where
|
||||||
let mut sockets = self.sockets.borrow_mut();
|
let mut sockets = self.sockets.borrow_mut();
|
||||||
let socket: &mut net::socket::TcpSocket = &mut *sockets.get(handle);
|
let socket: &mut net::socket::TcpSocket = &mut *sockets.get(handle);
|
||||||
socket.close();
|
socket.close();
|
||||||
self.unused_handles.borrow_mut().push(handle).unwrap();
|
let mut unused_handles = self.unused_handles.borrow_mut();
|
||||||
|
if unused_handles.iter().find(|&x| *x == handle).is_none() {
|
||||||
|
unused_handles.push(handle).unwrap();
|
||||||
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue