I've been working on getting more tests passing and had a bit of confusion when I worked on this one.
Particularly, between these lines:
// Check that the server resets the connection.
assert!(!peer_connected(&server, peer_id));
// Check that the server reconnects after a timeout.
event_loop.run_once(&mut server).unwrap();
assert!(peer_connected(&server, peer_id));
There is the output:
WARN:raft::server: Server(0): unable to reconnect connection PeerConnection(1): No such file or directory (os error 2)
So I dug into this a bit more and it looks like the addresses are still correct:
INFO:raft::connection: PeerConnection(1): PeerConnection(1) reset, will attempt to reconnect in 1ms
SERVER peer_listener.local_addr Ok(V4(127.0.0.1:52996))
CONENCTION &self.addr V4(127.0.0.1:52996)
WARN:raft::server: Server(0): unable to reconnect connection PeerConnection(1): No such file or directory (os error 2)
INFO:raft::connection: PeerConnection(1): PeerConnection(1) reset, will attempt to reconnect in 2ms
It appears that, since .accept() blocks and .run_once() will timeout and attempt any reconnections later, that we need to use threads for this.
Steps to Reproduce
Running:
RUST_BACKTRACE=1 RUST_LOG=raft=debug cargo test server::test::test_invalid_peer_message -- --nocapture
I've been working on getting more tests passing and had a bit of confusion when I worked on this one.
Particularly, between these lines:
There is the output:
So I dug into this a bit more and it looks like the addresses are still correct:
It appears that, since
.accept()
blocks and.run_once()
will timeout and attempt any reconnections later, that we need to use threads for this.Steps to Reproduce
Running:
Results in: