Skip to content

Commit 253aefc

Browse files
authored
delete notification handles before shutting down client (#45)
1 parent 6528479 commit 253aefc

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/client.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,11 @@ impl Drop for Client {
149149
.get_mut()
150150
.expect("notification handle cache lock was poisoned");
151151

152+
// Close all open notification handles.
153+
for (addr, handle) in std::mem::take(handles) {
154+
let _ = self.device(addr).delete_notification(handle);
155+
}
156+
152157
if let Ok(ref mut socket) = self.socket.lock() {
153158
// Remove our port from the router, if necessary.
154159
if self.source_port_opened {
@@ -161,11 +166,6 @@ impl Drop for Client {
161166
}
162167

163168
self.receiver.stop();
164-
165-
// Close all open notification handles.
166-
for (addr, handle) in std::mem::take(handles) {
167-
let _ = self.device(addr).delete_notification(handle);
168-
}
169169
}
170170
}
171171

0 commit comments

Comments
 (0)