Reuse request UDP port for responses

This commit is contained in:
Michael Vines
2018-07-02 11:19:51 -07:00
committed by Grimes
parent 04a93050e7
commit f2ab08c65e

View File

@ -156,16 +156,22 @@ fn main() {
Box::new(stdout()) 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( let server = Server::new_leader(
bank, bank,
entry_height, entry_height,
//Some(Duration::from_millis(1000)), //Some(Duration::from_millis(1000)),
None, None,
repl_data.clone(), repl_data.clone(),
UdpSocket::bind(local_requests_addr).unwrap(), requests_socket,
UdpSocket::bind(local_transactions_addr).unwrap(), UdpSocket::bind(local_transactions_addr).unwrap(),
UdpSocket::bind("0.0.0.0:0").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(), UdpSocket::bind(local_gossip_addr).unwrap(),
exit.clone(), exit.clone(),
outfile, outfile,