Skip to content

Commit

Permalink
Merge pull request ceph#3977 from tchaikov/fix-xio-loop-conn-cleanup
Browse files Browse the repository at this point in the history
Fix XioLoopbackConnection Lifecycle.

Reviewed-by: Sage Weil <[email protected]>
  • Loading branch information
liewegas committed Mar 16, 2015
2 parents a69055f + 595e87f commit ec2d8c9
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/msg/xio/XioConnection.h
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,6 @@ class XioLoopbackConnection : public Connection
}
};

typedef boost::intrusive_ptr<XioLoopbackConnection> LoopbackConnectionRef;
typedef boost::intrusive_ptr<XioLoopbackConnection> XioLoopbackConnectionRef;

#endif /* XIO_CONNECTION_H */
7 changes: 3 additions & 4 deletions src/msg/xio/XioMessenger.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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;
}
Expand Down
4 changes: 2 additions & 2 deletions src/msg/xio/XioMessenger.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class XioMessenger : public SimplePolicyMessenger
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;
Expand All @@ -57,7 +57,7 @@ class XioMessenger : public SimplePolicyMessenger

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);
Expand Down

0 comments on commit ec2d8c9

Please sign in to comment.