From f5735b28d154612b339cf5d3b558e4dc5eaa2884 Mon Sep 17 00:00:00 2001 From: Matt Benjamin Date: Wed, 11 Mar 2015 13:42:37 -0400 Subject: [PATCH] Fix XioLoopbackConnection Lifecycle. Since XioLoopbackConnection is a RefCountedObject, it can't be an expanded member of XioMessenger. Fixes cleanup/shutdown errors. Signed-off-by: Matt Benjamin --- src/msg/xio/XioConnection.h | 2 +- src/msg/xio/XioMessenger.cc | 7 +++---- src/msg/xio/XioMessenger.h | 4 ++-- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/msg/xio/XioConnection.h b/src/msg/xio/XioConnection.h index 21b19d098041..6ab116dd306e 100644 --- a/src/msg/xio/XioConnection.h +++ b/src/msg/xio/XioConnection.h @@ -352,6 +352,6 @@ public: } }; -typedef boost::intrusive_ptr LoopbackConnectionRef; +typedef boost::intrusive_ptr XioLoopbackConnectionRef; #endif /* XIO_CONNECTION_H */ diff --git a/src/msg/xio/XioMessenger.cc b/src/msg/xio/XioMessenger.cc index f084cfeb0cb7..59b1448145d2 100644 --- a/src/msg/xio/XioMessenger.cc +++ b/src/msg/xio/XioMessenger.cc @@ -251,7 +251,7 @@ XioMessenger::XioMessenger(CephContext *cct, entity_name_t name, shutdown_called(false), portals(this, cct->_conf->xio_portal_threads), dispatch_strategy(ds), - loop_con(this), + loop_con(new XioLoopbackConnection(this)), special_handling(0), sh_mtx("XioMessenger session mutex"), sh_cond() @@ -726,11 +726,10 @@ static inline XioMsg* pool_alloc_xio_msg(Message *m, XioConnection *xcon, int XioMessenger::_send_message(Message *m, Connection *con) { - if (con == &loop_con) { + if (con == loop_con.get() /* intrusive_ptr get() */) { m->set_connection(con); m->set_src(get_myinst().name); - XioLoopbackConnection *xlcon = static_cast(con); - m->set_seq(xlcon->next_seq()); + m->set_seq(loop_con->next_seq()); ds_dispatch(m); return 0; } diff --git a/src/msg/xio/XioMessenger.h b/src/msg/xio/XioMessenger.h index 8cec6d9c63ae..fe947fa663be 100644 --- a/src/msg/xio/XioMessenger.h +++ b/src/msg/xio/XioMessenger.h @@ -39,7 +39,7 @@ private: XioConnection::EntitySet conns_entity_map; XioPortals portals; DispatchStrategy* dispatch_strategy; - XioLoopbackConnection loop_con; + XioLoopbackConnectionRef loop_con; uint32_t special_handling; Mutex sh_mtx; Cond sh_cond; @@ -57,7 +57,7 @@ public: virtual void set_myaddr(const entity_addr_t& a) { Messenger::set_myaddr(a); - loop_con.set_peer_addr(a); + loop_con->set_peer_addr(a); } int _send_message(Message *m, const entity_inst_t &dest); -- 2.47.3