Tests need to introspect whether the connection is closed correctly.
For normal users, ms_handle_reset() will notify them when a connection is
closed by messenger.
Signed-off-by: Yingxin Cheng <yingxin.cheng@intel.com>
/// true if the handshake has completed and no errors have been encountered
virtual bool is_connected() const = 0;
+#ifdef UNIT_TESTS_BUILT
+ virtual bool is_closed() const = 0;
+#endif
+
/// send a message over a connection that has completed its handshake
virtual seastar::future<> send(MessageRef msg) = 0;
bool is_connected() const;
+ bool is_closed() const { return closed; }
+
// Reentrant closing
seastar::future<> close();
return protocol->is_connected();
}
+#ifdef UNIT_TESTS_BUILT
+bool SocketConnection::is_closed() const
+{
+ ceph_assert(seastar::engine().cpu_id() == shard_id());
+ return protocol->is_closed();
+}
+#endif
+
seastar::future<> SocketConnection::send(MessageRef msg)
{
// Cannot send msg from another core now, its ref counter can be contaminated!
bool is_connected() const override;
+#ifdef UNIT_TESTS_BUILT
+ bool is_closed() const override;
+#endif
+
seastar::future<> send(MessageRef msg) override;
seastar::future<> keepalive() override;