@@ -6,9 +6,9 @@ use ntex_util::{HashMap, future::Either, future::Ready};
66use slab:: Slab ;
77
88use 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} ;
1313use 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 ,
@@ -64,6 +65,12 @@ impl Session {
6465 Session { inner }
6566 }
6667
68+ #[ inline]
69+ /// Get begin frame reference
70+ pub fn frame ( & self ) -> & Begin {
71+ & self . inner . get_ref ( ) . begin
72+ }
73+
6774 #[ inline]
6875 /// Get io tag for current connection
6976 pub fn tag ( & self ) -> & ' static str {
@@ -282,17 +289,12 @@ impl SessionInner {
282289 local : bool ,
283290 sink : ConnectionRef ,
284291 remote_channel_id : u16 ,
285- next_incoming_id : DeliveryNumber ,
286- remote_incoming_window : u32 ,
287- remote_outgoing_window : u32 ,
292+ begin : Begin ,
288293 ) -> SessionInner {
289294 SessionInner {
290- id,
291- sink,
292- next_incoming_id,
293- remote_channel_id,
294- remote_incoming_window,
295- 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 ( ) ,
296298 flags : if local { Flags :: LOCAL } else { Flags :: empty ( ) } ,
297299 next_outgoing_id : INITIAL_NEXT_OUTGOING_ID ,
298300 unsettled_snd_deliveries : HashMap :: default ( ) ,
@@ -305,6 +307,10 @@ impl SessionInner {
305307 pool_notify : pool:: new ( ) ,
306308 pool_credit : pool:: new ( ) ,
307309 closed : condition:: Condition :: new ( ) ,
310+ id,
311+ sink,
312+ begin,
313+ remote_channel_id,
308314 }
309315 }
310316
@@ -1255,8 +1261,7 @@ impl SessionInner {
12551261 . sink
12561262 . config ( )
12571263 . write_buf ( )
1258- . buf_with_capacity ( msg. encoded_size ( ) )
1259- . into ( ) ;
1264+ . buf_with_capacity ( msg. encoded_size ( ) ) ;
12601265 msg. encode ( & mut buf) ;
12611266 buf. freeze ( )
12621267 }
0 commit comments