Skip to content

Commit

Permalink
Set transfer handle (#44)
Browse files Browse the repository at this point in the history
  • Loading branch information
fafhrd91 authored Mar 17, 2024
1 parent 59ccafc commit a8c676a
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changes

## [2.1.2] - 2024-03-17

* Set transfer handle

## [2.1.1] - 2024-03-12

* Fix default flow's next-incoming-id
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 = "2.1.1"
version = "2.1.2"
authors = ["ntex contributors <[email protected]>"]
description = "AMQP 1.0 Client/Server framework"
documentation = "https://docs.rs/ntex-amqp"
Expand Down
8 changes: 7 additions & 1 deletion src/session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -818,7 +818,10 @@ impl SessionInner {
if let Some(link) = self.links.get_mut(idx) {
match link {
Either::Left(_) => {
log::error!("{}: Got trasfer from sender link", self.tag());
log::error!(
"{}: Got unexpected trasfer from sender link",
self.tag()
);
Err(AmqpProtocolError::Unexpected(Frame::Transfer(transfer)))
}
Either::Right(link) => match link {
Expand Down Expand Up @@ -1247,6 +1250,7 @@ impl SessionInner {
let chunk = body.split_to(std::cmp::min(max_frame_size, body.len()));

let mut transfer = Transfer(Default::default());
transfer.0.handle = link_handle;
transfer.0.body = Some(TransferBody::Data(chunk));
transfer.0.more = true;
transfer.0.settled = Some(settled);
Expand Down Expand Up @@ -1288,13 +1292,15 @@ impl SessionInner {
log::trace!("{}: Sending chunk tranfer for {:?}", self.tag(), tag);

let mut transfer = Transfer(Default::default());
transfer.0.handle = link_handle;
transfer.0.body = Some(TransferBody::Data(chunk));
transfer.0.more = true;
transfer.0.batchable = true;
self.post_frame(Frame::Transfer(transfer));
}
} else {
let mut transfer = Transfer(Default::default());
transfer.0.handle = link_handle;
transfer.0.body = Some(body);
transfer.0.settled = Some(settled);
transfer.0.state = tr_settled;
Expand Down

0 comments on commit a8c676a

Please sign in to comment.