From f2ab08c65e0bfeec7f9338aa4cc3ab2a206ced5e Mon Sep 17 00:00:00 2001 From: Michael Vines Date: Mon, 2 Jul 2018 11:19:51 -0700 Subject: [PATCH] Reuse request UDP port for responses --- src/bin/fullnode.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/bin/fullnode.rs b/src/bin/fullnode.rs index 132ea9493a..1a886eb3ab 100644 --- a/src/bin/fullnode.rs +++ b/src/bin/fullnode.rs @@ -156,16 +156,22 @@ fn main() { Box::new(stdout()) }; + let requests_socket = UdpSocket::bind(local_requests_addr).unwrap(); + // Responses are sent from the same Udp port as requests are received + // from, in hopes that a NAT sitting in the middle will route the + // response Udp packet correctly back to the requester. + let respond_socket = requests_socket.try_clone().unwrap(); + let server = Server::new_leader( bank, entry_height, //Some(Duration::from_millis(1000)), None, repl_data.clone(), - UdpSocket::bind(local_requests_addr).unwrap(), + requests_socket, UdpSocket::bind(local_transactions_addr).unwrap(), UdpSocket::bind("0.0.0.0:0").unwrap(), - UdpSocket::bind("0.0.0.0:0").unwrap(), + respond_socket, UdpSocket::bind(local_gossip_addr).unwrap(), exit.clone(), outfile,