You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
During poll our heartbeat::Handler previously would count failed connection and close the connection after a set number of failures.
if self.failure_count >= self.config.max_failures.into() {
// Request from `Swarm` to close the faulty connection
return Poll::Ready(ConnectionHandlerEvent::Close(
HeartbeatFailure::Timeout,
))
}
They have since removed the ability for handlers to close connections: libp2p/rust-libp2p#4755
We still want bad connections to be closed and reopened, so we need a new solution.
Requirements
Write a test that shows when connections with a peer fail more than the max_failures, it closes the connection.
Implement code to pass that test 👍
The text was updated successfully, but these errors were encountered:
@MitchTurner Is it ok if the test just test that the handler send a notification to disconnect or we want ot test it at service level ? Because I'm having difficulties testing this at service level.
It might be the case that I was being overly prescriptive. It reads like typical TDD propaganda :). You have the context now to decide the best means of testing it, whether that is keeping the current arch or refactoring to a more testible design.
I always prefer to get with test first too and I prefer testing it at service level but I don't find a way to make the failure_count increase in tests at service level. There is too much process going on etc... so I wll propably end up doing it at handler level even if it's not my preference.
Context
During
poll
ourheartbeat::Handler
previously would count failed connection and close the connection after a set number of failures.They have since removed the ability for handlers to close connections: libp2p/rust-libp2p#4755
We still want bad connections to be closed and reopened, so we need a new solution.
Requirements
max_failures
, it closes the connection.The text was updated successfully, but these errors were encountered: