]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
msg: remove create_anon_connection from Messenger
authorCasey Bodley <casey@linuxbox.com>
Wed, 3 Sep 2014 15:53:49 +0000 (11:53 -0400)
committerMatt Benjamin <matt@cohortfs.com>
Wed, 14 Jan 2015 21:40:33 +0000 (16:40 -0500)
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 <casey@linuxbox.com>
Signed-off-by: Matt Benjamin <matt@cohortfs.com>
src/mon/Monitor.cc
src/msg/Messenger.h
src/msg/simple/SimpleMessenger.h

index 78e2061fe6bebf4d74d09f0423ac2bd896aee1b9..9d2880d9b1e81298ba5115cb921d76ee4fbda898 100644 (file)
@@ -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<Connection*>(c.get()));
     c->set_priv(s->get());
index 4462d6c5dfd1fc0d3bdc07937d3c030fbf3939e2..d6b542c4990fc3571c1e50db82ff9333698f870c 100644 (file)
@@ -150,11 +150,6 @@ public:
                           string lname,
                            uint64_t nonce);
 
-  /**
-   * create a anonymous Connection instance
-   */
-  virtual Connection *create_anon_connection() = 0;
-
   /**
    * @defgroup Accessors
    * @{
index 7581178f0a5fd260be7bbbfaf58c682be844b55e..a5adaecb7dd72fd2ce79c3aea31ab67ed815cf27 100644 (file)
@@ -182,10 +182,6 @@ public:
    */
   Pipe *add_accept_pipe(int sd);
 
-  Connection *create_anon_connection() {
-    return new PipeConnection(cct, NULL);
-  }
-
 private:
 
   /**