From: Casey Bodley Date: Wed, 3 Sep 2014 15:53:49 +0000 (-0400) Subject: msg: remove create_anon_connection from Messenger X-Git-Tag: v0.93~265^2~24 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=9fff0c53bdc7bb332df1a710da3de71e3c41bec7;p=ceph.git msg: remove create_anon_connection from Messenger the monitor now defines its own subclass of Connection to use for Monitor::handle_forward(), rather than tying it to the Messenger interface Signed-off-by: Casey Bodley Signed-off-by: Matt Benjamin --- diff --git a/src/mon/Monitor.cc b/src/mon/Monitor.cc index 78e2061fe6be..9d2880d9b1e8 100644 --- a/src/mon/Monitor.cc +++ b/src/mon/Monitor.cc @@ -2771,6 +2771,25 @@ void Monitor::forward_request_leader(PaxosServiceMessage *req) session->put(); } +// fake connection attached to forwarded messages +struct AnonConnection : public Connection { + AnonConnection(CephContext *cct) : Connection(cct, NULL) {} + + int send_message(Message *m) { + assert(!"send_message on anonymous connection"); + } + void send_keepalive() { + assert(!"send_keepalive on anonymous connection"); + } + void mark_down() { + assert(!"mark_down on anonymous connection"); + } + void mark_disposable() { + assert(!"mark_disposable on anonymous connection"); + } + bool is_connected() { return false; } +}; + //extract the original message and put it into the regular dispatch function void Monitor::handle_forward(MForward *m) { @@ -2785,7 +2804,7 @@ void Monitor::handle_forward(MForward *m) } else { // see PaxosService::dispatch(); we rely on this being anon // (c->msgr == NULL) - ConnectionRef c = messenger->create_anon_connection(); + ConnectionRef c(new AnonConnection(cct)); MonSession *s = new MonSession(m->msg->get_source_inst(), static_cast(c.get())); c->set_priv(s->get()); diff --git a/src/msg/Messenger.h b/src/msg/Messenger.h index 4462d6c5dfd1..d6b542c4990f 100644 --- a/src/msg/Messenger.h +++ b/src/msg/Messenger.h @@ -150,11 +150,6 @@ public: string lname, uint64_t nonce); - /** - * create a anonymous Connection instance - */ - virtual Connection *create_anon_connection() = 0; - /** * @defgroup Accessors * @{ diff --git a/src/msg/simple/SimpleMessenger.h b/src/msg/simple/SimpleMessenger.h index 7581178f0a5f..a5adaecb7dd7 100644 --- a/src/msg/simple/SimpleMessenger.h +++ b/src/msg/simple/SimpleMessenger.h @@ -182,10 +182,6 @@ public: */ Pipe *add_accept_pipe(int sd); - Connection *create_anon_connection() { - return new PipeConnection(cct, NULL); - } - private: /**