// used to throttle the connection if it's too busy.
virtual std::optional<seastar::future<>> ms_dispatch(ConnectionRef, MessageRef) = 0;
- virtual void ms_handle_accept(ConnectionRef conn) {}
+ // The connection is moving to the new_shard under accept/connect.
+ // User should not operate conn in this shard thereafter.
+ virtual void ms_handle_shard_change(
+ ConnectionRef conn,
+ seastar::shard_id new_shard,
+ bool is_accept_or_connect) {}
+
+ // The connection is accepted or recoverred(lossless), all the followup
+ // events and messages will be dispatched to this shard.
+ //
+ // is_replace=true means the accepted connection has replaced
+ // another connecting connection with the same peer_addr, which currently only
+ // happens under lossy policy when both sides wish to connect to each other.
+ virtual void ms_handle_accept(ConnectionRef conn, seastar::shard_id prv_shard, bool is_replace) {}
- virtual void ms_handle_connect(ConnectionRef conn) {}
+ // The connection is (re)connected, all the followup events and messages will
+ // be dispatched to this shard.
+ virtual void ms_handle_connect(ConnectionRef conn, seastar::shard_id prv_shard) {}
// a reset event is dispatched when the connection is closed unexpectedly.
+ //
// is_replace=true means the reset connection is going to be replaced by
// another accepting connection with the same peer_addr, which currently only
// happens under lossy policy when both sides wish to connect to each other.