@@ -59,7 +59,6 @@ use tokio_stream::wrappers::WatchStream;
5959use tokio_util:: sync:: CancellationToken ;
6060
6161use crate :: alloc:: Alloc ;
62- use crate :: alloc:: AllocAssignedAddr ;
6362use crate :: alloc:: AllocConstraints ;
6463use crate :: alloc:: AllocSpec ;
6564use crate :: alloc:: Allocator ;
@@ -70,6 +69,8 @@ use crate::alloc::ProcessAllocator;
7069use crate :: alloc:: REMOTE_ALLOC_BOOTSTRAP_ADDR ;
7170use crate :: alloc:: process:: CLIENT_TRACE_ID_LABEL ;
7271use crate :: alloc:: process:: ClientContext ;
72+ use crate :: alloc:: serve_with_config;
73+ use crate :: alloc:: with_unspecified_port_or_any;
7374use crate :: shortuuid:: ShortUuid ;
7475
7576/// Control messages sent from remote process allocator to local allocator.
@@ -91,7 +92,7 @@ pub enum RemoteProcessAllocatorMessage {
9192 /// the client_context will go to the message header instead
9293 client_context : Option < ClientContext > ,
9394 /// The address allocator should use for its forwarder.
94- forwarder_addr : AllocAssignedAddr ,
95+ forwarder_addr : ChannelAddr ,
9596 } ,
9697 /// Stop allocation.
9798 Stop ,
@@ -317,11 +318,11 @@ impl RemoteProcessAllocator {
317318 bootstrap_addr : ChannelAddr ,
318319 hosts : Vec < String > ,
319320 cancel_token : CancellationToken ,
320- forwarder_addr : AllocAssignedAddr ,
321+ forwarder_addr : ChannelAddr ,
321322 ) {
322323 tracing:: info!( "handle allocation request, bootstrap_addr: {bootstrap_addr}" ) ;
323324 // start proc message forwarder
324- let ( forwarder_addr, forwarder_rx) = match forwarder_addr . serve_with_config ( ) {
325+ let ( forwarder_addr, forwarder_rx) = match serve_with_config ( forwarder_addr ) {
325326 Ok ( v) => v,
326327 Err ( e) => {
327328 tracing:: error!( "failed to to bootstrap forwarder actor: {}" , e) ;
@@ -626,11 +627,11 @@ impl RemoteProcessAlloc {
626627 initializer : impl RemoteProcessAllocInitializer + Send + Sync + ' static ,
627628 ) -> Result < Self , anyhow:: Error > {
628629 let alloc_serve_addr = match config:: global:: try_get_cloned ( REMOTE_ALLOC_BOOTSTRAP_ADDR ) {
629- Some ( addr_str) => AllocAssignedAddr :: new ( addr_str. parse ( ) ?) ,
630- None => AllocAssignedAddr :: new ( ChannelAddr :: any ( spec. transport . clone ( ) ) ) ,
630+ Some ( addr_str) => addr_str. parse ( ) ?,
631+ None => ChannelAddr :: any ( spec. transport . clone ( ) ) ,
631632 } ;
632633
633- let ( bootstrap_addr, rx) = alloc_serve_addr . serve_with_config ( ) ?;
634+ let ( bootstrap_addr, rx) = serve_with_config ( alloc_serve_addr ) ?;
634635
635636 tracing:: info!(
636637 "starting alloc for {} on: {}" ,
@@ -825,7 +826,7 @@ impl RemoteProcessAlloc {
825826 // its host's private IP address, while its known addres to
826827 // alloc is a public IP address. In some environment, that
827828 // could lead to port unreachable error.
828- forwarder_addr : AllocAssignedAddr :: with_unspecified_port_or_any ( & remote_addr) ,
829+ forwarder_addr : with_unspecified_port_or_any ( & remote_addr) ,
829830 } ;
830831 tracing:: info!(
831832 name = message. as_ref( ) ,
@@ -1208,8 +1209,8 @@ impl Alloc for RemoteProcessAlloc {
12081209 /// one could lead to port unreachable error.
12091210 ///
12101211 /// For other channel types, this method still uses ChannelAddr::any.
1211- fn client_router_addr ( & self ) -> AllocAssignedAddr {
1212- AllocAssignedAddr :: with_unspecified_port_or_any ( & self . bootstrap_addr )
1212+ fn client_router_addr ( & self ) -> ChannelAddr {
1213+ with_unspecified_port_or_any ( & self . bootstrap_addr )
12131214 }
12141215}
12151216
@@ -1236,6 +1237,7 @@ mod test {
12361237 use crate :: alloc:: MockAllocWrapper ;
12371238 use crate :: alloc:: MockAllocator ;
12381239 use crate :: alloc:: ProcStopReason ;
1240+ use crate :: alloc:: with_unspecified_port_or_any;
12391241 use crate :: proc_mesh:: mesh_agent:: ProcMeshAgent ;
12401242
12411243 async fn read_all_created ( rx : & mut ChannelRx < RemoteProcessProcStateMessage > , alloc_len : usize ) {
@@ -1372,7 +1374,7 @@ mod test {
13721374 bootstrap_addr,
13731375 hosts : vec ! [ ] ,
13741376 client_context : None ,
1375- forwarder_addr : AllocAssignedAddr :: with_unspecified_port_or_any ( & tx. addr ( ) ) ,
1377+ forwarder_addr : with_unspecified_port_or_any ( & tx. addr ( ) ) ,
13761378 } )
13771379 . await
13781380 . unwrap ( ) ;
@@ -1526,7 +1528,7 @@ mod test {
15261528 bootstrap_addr,
15271529 hosts : vec ! [ ] ,
15281530 client_context : None ,
1529- forwarder_addr : AllocAssignedAddr :: with_unspecified_port_or_any ( & tx. addr ( ) ) ,
1531+ forwarder_addr : with_unspecified_port_or_any ( & tx. addr ( ) ) ,
15301532 } )
15311533 . await
15321534 . unwrap ( ) ;
@@ -1631,7 +1633,7 @@ mod test {
16311633 bootstrap_addr : bootstrap_addr. clone ( ) ,
16321634 hosts : vec ! [ ] ,
16331635 client_context : None ,
1634- forwarder_addr : AllocAssignedAddr :: with_unspecified_port_or_any ( & tx. addr ( ) ) ,
1636+ forwarder_addr : with_unspecified_port_or_any ( & tx. addr ( ) ) ,
16351637 } )
16361638 . await
16371639 . unwrap ( ) ;
@@ -1656,7 +1658,7 @@ mod test {
16561658 bootstrap_addr,
16571659 hosts : vec ! [ ] ,
16581660 client_context : None ,
1659- forwarder_addr : AllocAssignedAddr :: with_unspecified_port_or_any ( & tx. addr ( ) ) ,
1661+ forwarder_addr : with_unspecified_port_or_any ( & tx. addr ( ) ) ,
16601662 } )
16611663 . await
16621664 . unwrap ( ) ;
@@ -1754,7 +1756,7 @@ mod test {
17541756 bootstrap_addr,
17551757 hosts : vec ! [ ] ,
17561758 client_context : None ,
1757- forwarder_addr : AllocAssignedAddr :: with_unspecified_port_or_any ( & tx. addr ( ) ) ,
1759+ forwarder_addr : with_unspecified_port_or_any ( & tx. addr ( ) ) ,
17581760 } )
17591761 . await
17601762 . unwrap ( ) ;
@@ -1846,7 +1848,7 @@ mod test {
18461848 bootstrap_addr,
18471849 hosts : vec ! [ ] ,
18481850 client_context : None ,
1849- forwarder_addr : AllocAssignedAddr :: with_unspecified_port_or_any ( & tx. addr ( ) ) ,
1851+ forwarder_addr : with_unspecified_port_or_any ( & tx. addr ( ) ) ,
18501852 } )
18511853 . await
18521854 . unwrap ( ) ;
@@ -1941,7 +1943,7 @@ mod test {
19411943 client_context : Some ( ClientContext {
19421944 trace_id : test_trace_id. to_string ( ) ,
19431945 } ) ,
1944- forwarder_addr : AllocAssignedAddr :: with_unspecified_port_or_any ( & tx. addr ( ) ) ,
1946+ forwarder_addr : with_unspecified_port_or_any ( & tx. addr ( ) ) ,
19451947 } )
19461948 . await
19471949 . unwrap ( ) ;
@@ -2016,7 +2018,7 @@ mod test {
20162018 bootstrap_addr,
20172019 hosts : vec ! [ ] ,
20182020 client_context : None ,
2019- forwarder_addr : AllocAssignedAddr :: with_unspecified_port_or_any ( & tx. addr ( ) ) ,
2021+ forwarder_addr : with_unspecified_port_or_any ( & tx. addr ( ) ) ,
20202022 } )
20212023 . await
20222024 . unwrap ( ) ;
0 commit comments