This allows us to get the messenger associated with a connection.
Signed-off-by: Sage Weil <sage@inktank.com>
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);
// 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;
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),
connection_state = con->get();
connection_state->reset_pipe(this);
} else {
- connection_state = new Connection();
+ connection_state = new Connection(msgr);
connection_state->pipe = get();
}
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();