Use multiple sockets for receiving blobs on validators (#1228)

* Use multiple sockets for receiving blobs on validators

- The blobs that are broadcasted by leader or retransmitted by peer
  validators are received on replicate_port
- Using reuse_addr/reuse_port, multiple sockets can be opened for
  the same port
- This allows the kernel to queue data to user space app on multiple
  socket queues, preventing over-running one queue
- This helps with reducing packets dropped due to queue over-runs

Fixes #1224

* Fixed failing tests
This commit is contained in:
Pankaj Garg
2018-09-14 16:56:06 -07:00
committed by GitHub
parent 4196cf43e8
commit e142aafca9
4 changed files with 53 additions and 22 deletions

View File

@ -17,7 +17,7 @@ use std::thread::sleep;
use std::time::Duration;
fn test_node(exit: Arc<AtomicBool>) -> (Arc<RwLock<Crdt>>, Ncp, UdpSocket) {
let tn = Node::new_localhost();
let mut tn = Node::new_localhost();
let crdt = Crdt::new(tn.info.clone()).expect("Crdt::new");
let c = Arc::new(RwLock::new(crdt));
let w = Arc::new(RwLock::new(vec![]));
@ -29,7 +29,7 @@ fn test_node(exit: Arc<AtomicBool>) -> (Arc<RwLock<Crdt>>, Ncp, UdpSocket) {
tn.sockets.gossip,
exit,
);
(c, d, tn.sockets.replicate)
(c, d, tn.sockets.replicate.pop().unwrap())
}
/// Test that the network converges.