]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
dispatcher: new 'accept' event type
authorSage Weil <sage@inktank.com>
Tue, 10 Jul 2012 20:20:30 +0000 (13:20 -0700)
committerSage Weil <sage@inktank.com>
Tue, 10 Jul 2012 20:30:44 +0000 (13:30 -0700)
Create a new event type when we successfully accept a connection.  This is
distinct from the authorizor verification, which may happen for multiple
racing connection attempts.  In contrast, this will only happen on those
that win the race(s).  I don't think this is that important for stateless
servers (OSD, MON), but it is important for the MDS to ensure that it keeps
its Session con reference pointing to the most recently-successful
connection attempt.

Signed-off-by: Sage Weil <sage@inktank.com>
src/msg/Dispatcher.h
src/msg/Messenger.h

index d9155323f78ece790f89395ea5853bf8aab8b43f..f8c8ed703c16b6391f257ca2cf82e1bab0405450 100644 (file)
@@ -42,6 +42,13 @@ public:
    */
   virtual void ms_handle_connect(Connection *con) { };
 
+  /**
+   * Callback indicating we have accepted an incoming connection.
+   *
+   * @param con The (new or existing) Connection associated with the session
+   */
+  virtual void ms_handle_accept(Connection *con) { };
+
   /*
    * this indicates that the ordered+reliable delivery semantics have 
    * been violated.  Messages may have been lost due to a fault
index 947b18cf346ebc412c5ff5e4a97693b9d3ea5c04..94b6c54339fa0d51af17f7fa74cab6e9841412c7 100644 (file)
@@ -522,6 +522,20 @@ public:
         p++)
       (*p)->ms_handle_connect(con);
   }
+
+  /**
+   * Notify each Dispatcher of a new incomming Connection. Call
+   * this function whenever a new Connection is accepted.
+   *
+   * @param con Pointer to the new Connection.
+   */
+  void ms_deliver_handle_accept(Connection *con) {
+    for (list<Dispatcher*>::iterator p = dispatchers.begin();
+        p != dispatchers.end();
+        p++)
+      (*p)->ms_handle_accept(con);
+  }
+
   /**
    * Notify each Dispatcher of a Connection which may have lost
    * Messages. Call this function whenever you detect that a lossy Connection