Skip to content

Commit

Permalink
Handle unknown links
Browse files Browse the repository at this point in the history
  • Loading branch information
fafhrd91 committed Dec 3, 2024
1 parent 2f3f1aa commit 3c27991
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 5 deletions.
4 changes: 4 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changes

## [3.2.1] - 2024-12-03

* Handle unknown links

## [3.2.0] - 2024-12-03

* Fix control queue handling
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "ntex-amqp"
version = "3.2.0"
version = "3.2.1"
authors = ["ntex contributors <[email protected]>"]
description = "AMQP 1.0 Client/Server framework"
documentation = "https://docs.rs/ntex-amqp"
Expand Down
16 changes: 12 additions & 4 deletions src/session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -582,7 +582,9 @@ impl SessionInner {
}));
self.post_frame(detach.into());

self.links.remove(token);
if self.links.contains(token) {
self.links.remove(token);
}
}

pub(crate) fn get_sender_link_by_local_handle(&self, hnd: Handle) -> Option<&SenderLink> {
Expand Down Expand Up @@ -723,7 +725,9 @@ impl SessionInner {
}));
self.post_frame(detach.into());
let _ = tx.send(Ok(()));
let _ = self.links.remove(id as usize);
if self.links.contains(id as usize) {
let _ = self.links.remove(id as usize);
}
}
ReceiverLinkState::Established(receiver_link) => {
let receiver_link = receiver_link.clone();
Expand All @@ -742,7 +746,9 @@ impl SessionInner {
}
ReceiverLinkState::Closing(_) => {
let _ = tx.send(Ok(()));
let _ = self.links.remove(id as usize);
if self.links.contains(id as usize) {
let _ = self.links.remove(id as usize);
}
log::error!(
"{}: Unexpected receiver link state: closing - {}",
self.tag(),
Expand Down Expand Up @@ -1089,7 +1095,9 @@ impl SessionInner {
};

if remove {
self.links.remove(idx);
if self.links.contains(idx) {
self.links.remove(idx);
}
self.remote_handles.remove(&handle);
}
action
Expand Down

0 comments on commit 3c27991

Please sign in to comment.