Poll iface when dropping socket

This commit is contained in:
Jianfeng Jiang
2023-08-28 17:37:59 +08:00
committed by Tate, Hongliang Tian
parent dbf5a423b1
commit 4fef4d9b79
2 changed files with 4 additions and 2 deletions

View File

@ -174,6 +174,7 @@ impl AnyBoundSocket {
impl Drop for AnyBoundSocket {
fn drop(&mut self) {
self.close();
self.iface.poll();
self.iface.common().remove_socket(self.handle);
self.iface.common().release_port(self.port);
self.iface.common().remove_bound_socket(self.weak_ref());

View File

@ -138,8 +138,9 @@ impl IfaceCommon {
};
if has_events {
self.bound_sockets.read().iter().for_each(|bound_socket| {
let bound_socket = bound_socket.upgrade().unwrap();
bound_socket.update_socket_state();
if let Some(bound_socket) = bound_socket.upgrade() {
bound_socket.update_socket_state();
}
});
}