Hoverbear / old-raft-rs

[Incomplete] A Raft implementation in Rust
https://hoverbear.github.io/raft-rs/raft/
MIT License
266 stars 41 forks source link

Replica reset connection handling #54

Closed danburkert closed 9 years ago

danburkert commented 9 years ago

server.rs occasionally resets the Tcp connection to remote peers, either in the case that the peer reconnects to the local Server, or the local Server becomes disconnected and initiates a reconnection. In both cases existing messages in the send/receive queue are cleared. Clearing the messages is the correct behavior in the long run, but we currently do not handle it correctly, since the local Replica assumes any message sent to a peer (through the Actions struct) will be delivered.

This is easily fixed by adding a new event type for Replica to handle: connection_reset. This would inform the Replica that any outstanding messages to the peer should be considered lost, and give the Replica a chance to return an Actions struct containing messages to send to the peer on the new connection.

In all cases it is possible for the Replica to determine what messages to send based on it's local state: