@@ -3,6 +3,7 @@ use crate::{
33 channels:: Channels ,
44 consumer_status:: ConsumerStatus ,
55 error_holder:: ErrorHolder ,
6+ future:: InternalFuture ,
67 heartbeat:: Heartbeat ,
78 killswitch:: KillSwitch ,
89 options:: { BasicAckOptions , BasicCancelOptions , BasicNackOptions , BasicRejectOptions } ,
@@ -11,7 +12,7 @@ use crate::{
1112} ;
1213use async_rs:: { Runtime , traits:: * } ;
1314use flume:: { Receiver , Sender } ;
14- use std:: { collections:: HashMap , fmt, future:: Future , pin :: Pin , time:: Duration } ;
15+ use std:: { collections:: HashMap , fmt, future:: Future , time:: Duration } ;
1516use tracing:: trace;
1617
1718pub ( crate ) struct InternalRPC < RK : RuntimeKit + Clone + Send + ' static > {
@@ -162,14 +163,14 @@ impl InternalRPCHandle {
162163 }
163164
164165 pub ( crate ) fn spawn ( & self , f : impl Future < Output = Result < ( ) > > + Send + ' static ) {
165- self . send ( InternalCommand :: Spawn ( Box :: pin ( f) ) ) ;
166+ self . send ( InternalCommand :: Spawn ( InternalFuture ( Box :: pin ( f) ) ) ) ;
166167 }
167168
168169 pub ( crate ) fn spawn_infallible ( & self , f : impl Future < Output = ( ) > + Send + ' static ) {
169- self . send ( InternalCommand :: Spawn ( Box :: pin ( async move {
170+ self . spawn ( async move {
170171 f. await ;
171172 Ok ( ( ) )
172- } ) ) ) ;
173+ } ) ;
173174 }
174175
175176 pub ( crate ) fn start_channels_recovery ( & self ) {
@@ -190,7 +191,7 @@ impl InternalRPCHandle {
190191 }
191192
192193 fn send ( & self , command : InternalCommand ) {
193- trace ! ( "Queuing internal RPC command" ) ; // FIXME: restore ?command (future is not debug for Spawn)
194+ trace ! ( ?command , "Queuing internal RPC command" ) ;
194195 // The only scenario where this can fail if this is the IoLoop already exited
195196 let _ = self . sender . send ( Some ( command) ) ;
196197 self . waker . wake ( ) ;
@@ -203,6 +204,7 @@ impl fmt::Debug for InternalRPCHandle {
203204 }
204205}
205206
207+ #[ derive( Debug ) ]
206208enum InternalCommand {
207209 BasicAck (
208210 ChannelId ,
@@ -239,7 +241,7 @@ enum InternalCommand {
239241 SetConnectionClosing ,
240242 SetConnectionClosed ( Error ) ,
241243 SetConnectionError ( Error ) ,
242- Spawn ( Pin < Box < dyn Future < Output = Result < ( ) > > + Send + ' static > > ) ,
244+ Spawn ( InternalFuture ) ,
243245 StartChannelsRecovery ,
244246 StartHeartbeat ( Duration ) ,
245247}
@@ -310,7 +312,7 @@ impl<RK: RuntimeKit + Clone + Send + 'static> InternalRPC<RK> {
310312 } ;
311313
312314 while let Ok ( Some ( command) ) = rpc. recv_async ( ) . await {
313- trace ! ( "Handling internal RPC command" ) ; // FIXME: restore ?command (future is not debug for Spawn)
315+ trace ! ( ?command , "Handling internal RPC command" ) ;
314316 match command {
315317 BasicAck ( channel_id, delivery_tag, options, resolver, error) => {
316318 if !self . channel_ok ( channel_id) {
0 commit comments