Skip to content

Commit adb22de

Browse files
committed
wip
1 parent 51e8c75 commit adb22de

File tree

2 files changed

+13
-11
lines changed

2 files changed

+13
-11
lines changed

src/connection.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ impl ConnectionInner {
245245
pub(crate) fn register_remote_session(
246246
&mut self,
247247
remote_channel_id: u16,
248-
begin: &Begin,
248+
begin: Begin,
249249
cell: &Cell<ConnectionInner>,
250250
) -> Result<(), AmqpProtocolError> {
251251
log::trace!(
@@ -256,6 +256,7 @@ impl ConnectionInner {
256256

257257
let entry = self.sessions.vacant_entry();
258258
let local_token = entry.key();
259+
let outgoing_window = begin.incoming_window();
259260

260261
let session = Cell::new(SessionInner::new(
261262
local_token,
@@ -268,10 +269,10 @@ impl ConnectionInner {
268269
self.sessions_map.insert(remote_channel_id, local_token);
269270

270271
let begin = Begin(Box::new(codec::BeginInner {
272+
outgoing_window,
271273
remote_channel: Some(remote_channel_id),
272274
next_outgoing_id: 1,
273275
incoming_window: u32::MAX,
274-
outgoing_window: begin.incoming_window(),
275276
handle_max: u32::MAX,
276277
offered_capabilities: None,
277278
desired_capabilities: None,
@@ -291,7 +292,7 @@ impl ConnectionInner {
291292
&mut self,
292293
local_channel_id: u16,
293294
remote_channel_id: u16,
294-
begin: &Begin,
295+
begin: Begin,
295296
) {
296297
log::trace!(
297298
"{}: Begin response received: local {:?} remote {:?}",
@@ -377,9 +378,9 @@ impl ConnectionInner {
377378
// the remote-channel property in the frame is the local channel id
378379
// we previously sent to the remote
379380
if let Some(local_channel_id) = begin.remote_channel() {
380-
self.complete_session_creation(local_channel_id, channel_id, &begin);
381+
self.complete_session_creation(local_channel_id, channel_id, begin);
381382
} else {
382-
self.register_remote_session(channel_id, &begin, inner)?;
383+
self.register_remote_session(channel_id, begin, inner)?;
383384
}
384385
return Ok(Action::None);
385386
}

src/session.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ use ntex_util::{HashMap, future::Either, future::Ready};
66
use slab::Slab;
77

88
use ntex_amqp_codec::protocol::{
9-
self as codec, Accepted, Attach, DeliveryNumber, DeliveryState, Detach, Disposition, End,
10-
Error, Flow, Frame, Handle, MessageFormat, ReceiverSettleMode, Role, SenderSettleMode, Source,
11-
Transfer, TransferBody, TransferNumber,
9+
self as codec, Accepted, Attach, Begin, DeliveryNumber, DeliveryState, Detach, Disposition,
10+
End, Error, Flow, Frame, Handle, MessageFormat, ReceiverSettleMode, Role, SenderSettleMode,
11+
Source, Transfer, TransferBody, TransferNumber,
1212
};
1313
use ntex_amqp_codec::{AmqpFrame, Encode};
1414

@@ -33,6 +33,7 @@ pub(crate) struct SessionInner {
3333
sink: ConnectionRef,
3434
next_outgoing_id: TransferNumber,
3535
flags: Flags,
36+
begin: Begin,
3637

3738
remote_channel_id: u16,
3839
next_incoming_id: TransferNumber,
@@ -291,9 +292,9 @@ impl SessionInner {
291292
begin: Begin,
292293
) -> SessionInner {
293294
SessionInner {
294-
next_incoming_id: begin.next_incoming_id(),
295-
remote_incoming_window: begin.remote_incoming_window(),
296-
remote_outgoing_window: begin.remote_outgoing_window(),
295+
next_incoming_id: begin.next_outgoing_id(),
296+
remote_incoming_window: begin.incoming_window(),
297+
remote_outgoing_window: begin.outgoing_window(),
297298
flags: if local { Flags::LOCAL } else { Flags::empty() },
298299
next_outgoing_id: INITIAL_NEXT_OUTGOING_ID,
299300
unsettled_snd_deliveries: HashMap::default(),

0 commit comments

Comments
 (0)