@@ -2819,28 +2819,30 @@ impl Node {
2819
2819
Self :: new_localhost_with_pubkey ( & pubkey)
2820
2820
}
2821
2821
pub fn new_localhost_with_pubkey ( pubkey : & Pubkey ) -> Self {
2822
- let bind_ip_addr = IpAddr :: V4 ( Ipv4Addr :: LOCALHOST ) ;
2822
+ let localhost_ip_addr = IpAddr :: V4 ( Ipv4Addr :: LOCALHOST ) ;
2823
+ let localhost_bind_addr = format ! ( "{:?}:0" , localhost_ip_addr) ;
2824
+ let unspecified_bind_addr = format ! ( "{:?}:0" , IpAddr :: V4 ( Ipv4Addr :: UNSPECIFIED ) ) ;
2823
2825
let port_range = ( 1024 , 65535 ) ;
2826
+
2824
2827
let ( ( _tpu_port, tpu) , ( _tpu_quic_port, tpu_quic) ) =
2825
- bind_two_in_range_with_offset ( bind_ip_addr , port_range, QUIC_PORT_OFFSET ) . unwrap ( ) ;
2828
+ bind_two_in_range_with_offset ( localhost_ip_addr , port_range, QUIC_PORT_OFFSET ) . unwrap ( ) ;
2826
2829
let ( gossip_port, ( gossip, ip_echo) ) =
2827
- bind_common_in_range ( bind_ip_addr , port_range) . unwrap ( ) ;
2828
- let gossip_addr = SocketAddr :: new ( IpAddr :: V4 ( Ipv4Addr :: LOCALHOST ) , gossip_port) ;
2829
- let tvu = UdpSocket :: bind ( "127.0.0.1:0" ) . unwrap ( ) ;
2830
- let tvu_forwards = UdpSocket :: bind ( "127.0.0.1:0" ) . unwrap ( ) ;
2830
+ bind_common_in_range ( localhost_ip_addr , port_range) . unwrap ( ) ;
2831
+ let gossip_addr = SocketAddr :: new ( localhost_ip_addr , gossip_port) ;
2832
+ let tvu = UdpSocket :: bind ( & localhost_bind_addr ) . unwrap ( ) ;
2833
+ let tvu_forwards = UdpSocket :: bind ( & localhost_bind_addr ) . unwrap ( ) ;
2831
2834
let ( ( _tpu_forwards_port, tpu_forwards) , ( _tpu_forwards_quic_port, tpu_forwards_quic) ) =
2832
- bind_two_in_range_with_offset ( bind_ip_addr, port_range, QUIC_PORT_OFFSET ) . unwrap ( ) ;
2833
- let tpu_vote = UdpSocket :: bind ( "127.0.0.1:0" ) . unwrap ( ) ;
2834
- let repair = UdpSocket :: bind ( "127.0.0.1:0" ) . unwrap ( ) ;
2835
- let rpc_port = find_available_port_in_range ( bind_ip_addr, port_range) . unwrap ( ) ;
2836
- let rpc_addr = SocketAddr :: new ( IpAddr :: V4 ( Ipv4Addr :: LOCALHOST ) , rpc_port) ;
2837
- let rpc_pubsub_port = find_available_port_in_range ( bind_ip_addr, port_range) . unwrap ( ) ;
2838
- let rpc_pubsub_addr = SocketAddr :: new ( IpAddr :: V4 ( Ipv4Addr :: LOCALHOST ) , rpc_pubsub_port) ;
2839
-
2840
- let broadcast = vec ! [ UdpSocket :: bind( "0.0.0.0:0" ) . unwrap( ) ] ;
2841
- let retransmit_socket = UdpSocket :: bind ( "0.0.0.0:0" ) . unwrap ( ) ;
2842
- let serve_repair = UdpSocket :: bind ( "127.0.0.1:0" ) . unwrap ( ) ;
2843
- let ancestor_hashes_requests = UdpSocket :: bind ( "0.0.0.0:0" ) . unwrap ( ) ;
2835
+ bind_two_in_range_with_offset ( localhost_ip_addr, port_range, QUIC_PORT_OFFSET ) . unwrap ( ) ;
2836
+ let tpu_vote = UdpSocket :: bind ( & localhost_bind_addr) . unwrap ( ) ;
2837
+ let repair = UdpSocket :: bind ( & localhost_bind_addr) . unwrap ( ) ;
2838
+ let rpc_port = find_available_port_in_range ( localhost_ip_addr, port_range) . unwrap ( ) ;
2839
+ let rpc_addr = SocketAddr :: new ( localhost_ip_addr, rpc_port) ;
2840
+ let rpc_pubsub_port = find_available_port_in_range ( localhost_ip_addr, port_range) . unwrap ( ) ;
2841
+ let rpc_pubsub_addr = SocketAddr :: new ( localhost_ip_addr, rpc_pubsub_port) ;
2842
+ let broadcast = vec ! [ UdpSocket :: bind( & unspecified_bind_addr) . unwrap( ) ] ;
2843
+ let retransmit_socket = UdpSocket :: bind ( & unspecified_bind_addr) . unwrap ( ) ;
2844
+ let serve_repair = UdpSocket :: bind ( & localhost_bind_addr) . unwrap ( ) ;
2845
+ let ancestor_hashes_requests = UdpSocket :: bind ( & unspecified_bind_addr) . unwrap ( ) ;
2844
2846
2845
2847
let mut info = ContactInfo :: new (
2846
2848
* pubkey,
0 commit comments