Skip to content

Commit 3c27991

Browse files
committed
Handle unknown links
1 parent 2f3f1aa commit 3c27991

File tree

3 files changed

+17
-5
lines changed

3 files changed

+17
-5
lines changed

CHANGES.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changes
22

3+
## [3.2.1] - 2024-12-03
4+
5+
* Handle unknown links
6+
37
## [3.2.0] - 2024-12-03
48

59
* Fix control queue handling

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "ntex-amqp"
3-
version = "3.2.0"
3+
version = "3.2.1"
44
authors = ["ntex contributors <[email protected]>"]
55
description = "AMQP 1.0 Client/Server framework"
66
documentation = "https://docs.rs/ntex-amqp"

src/session.rs

+12-4
Original file line numberDiff line numberDiff line change
@@ -582,7 +582,9 @@ impl SessionInner {
582582
}));
583583
self.post_frame(detach.into());
584584

585-
self.links.remove(token);
585+
if self.links.contains(token) {
586+
self.links.remove(token);
587+
}
586588
}
587589

588590
pub(crate) fn get_sender_link_by_local_handle(&self, hnd: Handle) -> Option<&SenderLink> {
@@ -723,7 +725,9 @@ impl SessionInner {
723725
}));
724726
self.post_frame(detach.into());
725727
let _ = tx.send(Ok(()));
726-
let _ = self.links.remove(id as usize);
728+
if self.links.contains(id as usize) {
729+
let _ = self.links.remove(id as usize);
730+
}
727731
}
728732
ReceiverLinkState::Established(receiver_link) => {
729733
let receiver_link = receiver_link.clone();
@@ -742,7 +746,9 @@ impl SessionInner {
742746
}
743747
ReceiverLinkState::Closing(_) => {
744748
let _ = tx.send(Ok(()));
745-
let _ = self.links.remove(id as usize);
749+
if self.links.contains(id as usize) {
750+
let _ = self.links.remove(id as usize);
751+
}
746752
log::error!(
747753
"{}: Unexpected receiver link state: closing - {}",
748754
self.tag(),
@@ -1089,7 +1095,9 @@ impl SessionInner {
10891095
};
10901096

10911097
if remove {
1092-
self.links.remove(idx);
1098+
if self.links.contains(idx) {
1099+
self.links.remove(idx);
1100+
}
10931101
self.remote_handles.remove(&handle);
10941102
}
10951103
action

0 commit comments

Comments
 (0)