]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
Fix XioLoopbackConnection Lifecycle. 3977/head
authorMatt Benjamin <matt@cohortfs.com>
Wed, 11 Mar 2015 17:42:37 +0000 (13:42 -0400)
committerKefu Chai <kchai@redhat.com>
Thu, 12 Mar 2015 09:20:52 +0000 (17:20 +0800)
Since XioLoopbackConnection is a RefCountedObject, it can't be
an expanded member of XioMessenger.

Fixes cleanup/shutdown errors.

Signed-off-by: Matt Benjamin <matt@cohortfs.com>
(cherry picked from commit f5735b28d154612b339cf5d3b558e4dc5eaa2884)

src/msg/xio/XioConnection.h
src/msg/xio/XioMessenger.cc
src/msg/xio/XioMessenger.h

index 21b19d098041d0a9fd97c46045cbe3c83c36aea6..6ab116dd306ec683f75a0665f5331208be4f06ba 100644 (file)
@@ -352,6 +352,6 @@ public:
   }
 };
 
-typedef boost::intrusive_ptr<XioLoopbackConnection> LoopbackConnectionRef;
+typedef boost::intrusive_ptr<XioLoopbackConnection> XioLoopbackConnectionRef;
 
 #endif /* XIO_CONNECTION_H */
index f5c650673e310bd0c5ed64d5b5e6f32847384c68..de292c2bab23bf8245cee78e63931141b6c7c000 100644 (file)
@@ -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<XioLoopbackConnection*>(con);
-    m->set_seq(xlcon->next_seq());
+    m->set_seq(loop_con->next_seq());
     ds_dispatch(m);
     return 0;
   }
index 8cec6d9c63aeba04707c3779139522047a733064..fe947fa663be85ebf1d50a096873ef215cdef9b4 100644 (file)
@@ -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);