]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
msgr: add Messenger reference to Connection
authorSage Weil <sage@inktank.com>
Wed, 22 May 2013 15:13:21 +0000 (08:13 -0700)
committerSage Weil <sage@inktank.com>
Wed, 22 May 2013 23:13:37 +0000 (16:13 -0700)
This allows us to get the messenger associated with a connection.

Signed-off-by: Sage Weil <sage@inktank.com>
src/mon/Monitor.cc
src/msg/Message.h
src/msg/Pipe.cc
src/msg/SimpleMessenger.cc

index f1d16aa69e85af45367738422e4940259e3953ee..acfeb65da6726af07fb990db4f10639792ea936c 100644 (file)
@@ -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);
index 33d26b2e7da2a4476aeff0405224a75b6556c649..79a00c06fbe8c1f9f5764c0be7d4362a721f6f1c 100644 (file)
 
 // 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),
index f4100bc483bdade391d30672a8718be9fe1bdce1..42d461ac2f8dbb70a24601fbbfaf39c7ff16dc0d 100644 (file)
@@ -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();
   }
 
index 426fe237b76040b7680af46634b90831cd79f445..c9764fac324f46f23ce83a32d4779da3001a105d 100644 (file)
@@ -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();