From: Sage Weil Date: Wed, 22 May 2013 15:13:21 +0000 (-0700) Subject: msgr: add Messenger reference to Connection X-Git-Tag: v0.64~61^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=92a558bf0e5fee6d5250e1085427bff22fe4bbe4;p=ceph.git msgr: add Messenger reference to Connection This allows us to get the messenger associated with a connection. Signed-off-by: Sage Weil --- diff --git a/src/mon/Monitor.cc b/src/mon/Monitor.cc index f1d16aa69e85..acfeb65da672 100644 --- a/src/mon/Monitor.cc +++ b/src/mon/Monitor.cc @@ -2887,7 +2887,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 33d26b2e7da2..79a00c06fbe8 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 > 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 f4100bc483bd..42d461ac2f8d 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 426fe237b760..c9764fac324f 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();