diff options
author | Sage Weil <sage@inktank.com> | 2013-05-22 08:13:21 -0700 |
---|---|---|
committer | Sage Weil <sage@inktank.com> | 2013-06-02 16:34:17 -0700 |
commit | 36d948981685114d2fe807f480c19aade7497194 (patch) | |
tree | bde72e58b87bf996a31b3fdc1905825681820f15 | |
parent | 61135964419ecf5165366724d064b623b517fb4e (diff) | |
download | ceph-36d948981685114d2fe807f480c19aade7497194.tar.gz |
msgr: add Messenger reference to Connection
This allows us to get the messenger associated with a connection.
Signed-off-by: Sage Weil <sage@inktank.com>
(cherry picked from commit 92a558bf0e5fee6d5250e1085427bff22fe4bbe4)
-rw-r--r-- | src/mon/Monitor.cc | 2 | ||||
-rw-r--r-- | src/msg/Message.h | 5 | ||||
-rw-r--r-- | src/msg/Pipe.cc | 2 | ||||
-rw-r--r-- | src/msg/SimpleMessenger.cc | 2 |
4 files changed, 7 insertions, 4 deletions
diff --git a/src/mon/Monitor.cc b/src/mon/Monitor.cc index 3660af09228..aa76d43730d 100644 --- a/src/mon/Monitor.cc +++ b/src/mon/Monitor.cc @@ -2869,7 +2869,7 @@ void Monitor::handle_forward(MForward *m) dout(0) << "forward from entity with insufficient caps! " << session->caps << dendl; } else { - Connection *c = new Connection; + Connection *c = new Connection(NULL); MonSession *s = new MonSession(m->msg->get_source_inst(), c); c->set_priv(s); c->set_peer_addr(m->client.addr); diff --git a/src/msg/Message.h b/src/msg/Message.h index 33d26b2e7da..79a00c06fbe 100644 --- a/src/msg/Message.h +++ b/src/msg/Message.h @@ -157,9 +157,11 @@ // abstract Connection, for keeping per-connection state +class Messenger; struct Connection : public RefCountedObject { Mutex lock; + Messenger *msgr; RefCountedObject *priv; int peer_type; entity_addr_t peer_addr; @@ -171,8 +173,9 @@ struct Connection : public RefCountedObject { map<tid_t,pair<bufferlist,int> > rx_buffers; public: - Connection() + Connection(Messenger *m) : lock("Connection::lock"), + msgr(m), priv(NULL), peer_type(-1), features(0), diff --git a/src/msg/Pipe.cc b/src/msg/Pipe.cc index f4100bc483b..42d461ac2f8 100644 --- a/src/msg/Pipe.cc +++ b/src/msg/Pipe.cc @@ -75,7 +75,7 @@ Pipe::Pipe(SimpleMessenger *r, int st, Connection *con) connection_state = con->get(); connection_state->reset_pipe(this); } else { - connection_state = new Connection(); + connection_state = new Connection(msgr); connection_state->pipe = get(); } diff --git a/src/msg/SimpleMessenger.cc b/src/msg/SimpleMessenger.cc index 46e51dcf9f2..148300f159c 100644 --- a/src/msg/SimpleMessenger.cc +++ b/src/msg/SimpleMessenger.cc @@ -51,7 +51,7 @@ SimpleMessenger::SimpleMessenger(CephContext *cct, entity_name_t name, dispatch_throttler(cct, string("msgr_dispatch_throttler-") + mname, cct->_conf->ms_dispatch_throttle_bytes), reaper_started(false), reaper_stop(false), timeout(0), - local_connection(new Connection) + local_connection(new Connection(this)) { pthread_spin_init(&global_seq_lock, PTHREAD_PROCESS_PRIVATE); init_local_connection(); |