]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
auth: kill client side timeouts
authorSage Weil <sage@newdream.net>
Thu, 22 Oct 2009 22:30:00 +0000 (15:30 -0700)
committerSage Weil <sage@newdream.net>
Thu, 22 Oct 2009 23:51:20 +0000 (16:51 -0700)
The monclient will do the timing out.

src/auth/AuthClientHandler.cc
src/auth/AuthClientHandler.h
src/mon/MonClient.cc

index b02b0a267f2b01b55ee979bd6787a4175acc6bf7..ae14b87dc4208d2134fa999c4fb2aaa81183ca9d 100644 (file)
@@ -25,8 +25,7 @@
 
 
 AuthClientProtocolHandler::AuthClientProtocolHandler(AuthClientHandler *client) : 
-                        msg(NULL), got_response(false), got_timeout(false),
-                        timeout_event(NULL), lock("AuthClientProtocolHandler")
+                        msg(NULL), got_response(false), lock("AuthClientProtocolHandler")
 {
   dout(0) << "AuthClientProtocolHandler::AuthClientProtocolHandler" << dendl;
   this->client = client;
@@ -48,41 +47,14 @@ int AuthClientProtocolHandler::build_request()
   return ret;
 }
 
-int AuthClientProtocolHandler::do_async_request(double timeout)
+int AuthClientProtocolHandler::do_async_request()
 {
   got_response = false;
   client->client->send_auth_message(msg);
 
-#if 0
-  // schedule timeout?
-  assert(timeout_event == 0);
-  timeout_event = new C_OpTimeout(this, timeout);
-  client->timer.add_event_after(timeout, timeout_event);
-
-
-  dout(0) << "got_response=" << got_response << " got_timeout=" << got_timeout << dendl;
-
-  // finish.
-  if (timeout_event) {
-    client->timer.cancel_event(timeout_event);
-    timeout_event = NULL;
-  }
-#endif
-
   return 0;
 }
 
-void AuthClientProtocolHandler::_request_timeout(double timeout)
-{
-  dout(10) << "_request_timeout" << dendl;
-  timeout_event = NULL;
-  if (!got_response) {
-    got_timeout = 1;
-    cond.Signal();
-  }
-  status = -ETIMEDOUT;
-}
-
 int AuthClientProtocolHandler::handle_response(int ret, bufferlist::iterator& iter)
 {
   if (!client) {
@@ -397,7 +369,7 @@ int AuthClientHandler::handle_response(int trans_id, Message *response)
   return handler->handle_response(ret, iter);
 }
 
-int AuthClientHandler::send_session_request(AuthClient *client, AuthClientProtocolHandler *handler, double timeout)
+int AuthClientHandler::send_session_request(AuthClient *client, AuthClientProtocolHandler *handler)
 {
   Mutex::Locker l(lock);
   this->client = client;
@@ -408,7 +380,7 @@ int AuthClientHandler::send_session_request(AuthClient *client, AuthClientProtoc
   if (err < 0)
     return err;
 
-  err = handler->do_async_request(timeout);
+  err = handler->do_async_request();
   dout(0) << "handler.do_async_request returned " << err << dendl;
 
   return err;
index 93fbd5ad9a8914da1a2cb4e47bb62194059b28f2..65c155f85f39cfe1c5ac3ad8214e8b991b8e4f43 100644 (file)
@@ -30,25 +30,10 @@ class AuthClient;
 class AuthClientHandler;
 
 class AuthClientProtocolHandler {
- class C_OpTimeout : public Context {
-  protected:
-    AuthClientProtocolHandler *client;
-    double timeout;
-  public:
-    C_OpTimeout(AuthClientProtocolHandler *handler, double to) :
-                                        client(handler), timeout(to) {
-    }
-    void finish(int r) {
-      if (r >= 0) client->_request_timeout(timeout);
-    }
-  };
-
 protected:
   AuthClientHandler *client;
   Message *msg;
   bool got_response;
-  bool got_timeout;
-  Context *timeout_event;
   uint32_t id;
   Mutex lock;
   AuthAuthorizer authorizer;
@@ -65,7 +50,6 @@ protected:
   virtual Message *_get_new_msg() = 0;
   virtual bufferlist& _get_msg_bl(Message *m) = 0;
 
-  void _request_timeout(double timeout);
 public:
   AuthClientProtocolHandler(AuthClientHandler *ch);
   virtual ~AuthClientProtocolHandler();
@@ -78,7 +62,7 @@ public:
     _reset();
   }
 
- int do_async_request(double timeout);
+ int do_async_request();
 };
 
 class AuthClientAuthenticateHandler : public AuthClientProtocolHandler {
@@ -106,7 +90,6 @@ protected:
     response_state = 0;
     cephx_request_state = 0;
     cephx_response_state = 0;
-    timeout_event = NULL;
   }
 
   bool request_pending();
@@ -149,19 +132,12 @@ class AuthClientHandler {
 
   AuthClient *client;
 
-  Message *build_authenticate_request();
-
-
-  SafeTimer timer;
-
   uint32_t max_proto_handlers;
   map<uint32_t, AuthClientProtocolHandler *> handlers_map;
 
   AuthClientProtocolHandler *_get_proto_handler(uint32_t id);
   uint32_t _add_proto_handler(AuthClientProtocolHandler *handler);
 
-  void _authenticate_request_timeout(double timeout);
-  int _do_authenticate_request(double timeout);
 public:
   EntityName name;
   entity_addr_t addr;
@@ -172,7 +148,7 @@ public:
   AuthTicketManager tickets;
 
   AuthClientHandler() : lock("AuthClientHandler::lock"),
-                       client(NULL), timer(lock), max_proto_handlers(0) { }
+                       client(NULL), max_proto_handlers(0) { }
   void init(EntityName& n) { name = n; }
   
   void set_want_keys(__u32 keys) {
@@ -198,7 +174,7 @@ public:
 
   int handle_response(int trans_id, Message *response);
 
-  int send_session_request(AuthClient *client, AuthClientProtocolHandler *handler, double timeout);
+  int send_session_request(AuthClient *client, AuthClientProtocolHandler *handler);
   void tick();
 
   int build_authorizer(uint32_t service_id, AuthAuthorizer& authorizer);
index 9a79fb4d912917f4b785a63c77b6d798fb74f592..48477f25567a542017bab0a219368762795a67ce 100644 (file)
@@ -312,14 +312,14 @@ void MonClient::handle_auth(MAuthReply *m)
   delete m;
 
   if (ret == -EAGAIN) {
-    auth.send_session_request(this, &auth_handler, 30.0);
+    auth.send_session_request(this, &auth_handler);
   } else {
     switch (state) {
     case MC_STATE_AUTHENTICATING:
       {
         dout(0) << "done authenticating" << dendl;
         state = MC_STATE_AUTHENTICATED;
-        auth.send_session_request(this, &authorize_handler, 30.0);
+        auth.send_session_request(this, &authorize_handler);
       }
       break;
     case MC_STATE_AUTHENTICATED:
@@ -377,7 +377,7 @@ void MonClient::_reopen_session()
     state = MC_STATE_AUTHENTICATING;
     auth_handler.reset();
     authorize_handler.reset();
-    auth.send_session_request(this, &auth_handler, 30.0);
+    auth.send_session_request(this, &auth_handler);
   }
 
   if (g_keyring.need_rotating_secrets())