summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSage Weil <sage@inktank.com>2013-05-22 08:13:21 -0700
committerSage Weil <sage@inktank.com>2013-05-22 16:13:37 -0700
commit92a558bf0e5fee6d5250e1085427bff22fe4bbe4 (patch)
tree2e3a98ca038dc94fd1c924fb31c1fc8ab3dc3478 /src
parent28851424bf8290258a3dcb121d6f10d8b299054a (diff)
downloadceph-92a558bf0e5fee6d5250e1085427bff22fe4bbe4.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>
Diffstat (limited to 'src')
-rw-r--r--src/mon/Monitor.cc2
-rw-r--r--src/msg/Message.h5
-rw-r--r--src/msg/Pipe.cc2
-rw-r--r--src/msg/SimpleMessenger.cc2
4 files changed, 7 insertions, 4 deletions
diff --git a/src/mon/Monitor.cc b/src/mon/Monitor.cc
index f1d16aa69e8..acfeb65da67 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 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 426fe237b76..c9764fac324 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();