Przeglądaj źródła

ZOOKEEPER-320. call auth completion in free_completions(). (chris darroch via mahadev)

git-svn-id: https://svn.apache.org/repos/asf/hadoop/zookeeper/trunk@748672 13f79535-47bb-0310-9956-ffa450edef68
Mahadev Konar 16 lat temu
rodzic
commit
c540566868
2 zmienionych plików z 17 dodań i 0 usunięć
  1. 3 0
      CHANGES.txt
  2. 14 0
      src/c/src/zookeeper.c

+ 3 - 0
CHANGES.txt

@@ -14,6 +14,9 @@ and datadir. (chris darroch and mahadev)
 
   ZOOKEEPER-319. add locking around auth info in zhandle_t. (chris darroch via
 mahadev)
+
+  ZOOKEEPER-320. call auth completion in free_completions(). (chris darroch
+via mahadev)
  
 IMPROVEMENTS:
   ZOOKEEPER-308. improve the atomic broadcast performance 3x. (breed via

+ 14 - 0
src/c/src/zookeeper.c

@@ -761,6 +761,8 @@ void free_completions(zhandle_t *zh,int callCompletion,int reason)
     completion_head_t tmp_list;
     struct oarchive *oa;
     struct ReplyHeader h;
+    void_completion_t auth_completion = NULL;
+    const char *auth_data = NULL;
 
     lock_completion_list(&zh->sent_requests);
     tmp_list = zh->sent_requests;
@@ -800,6 +802,18 @@ void free_completions(zhandle_t *zh,int callCompletion,int reason)
             }
         }
     }
+
+    zoo_lock_auth(zh);
+    if (zh->auth.completion) {
+        auth_completion = zh->auth.completion;
+        auth_data = zh->auth.data;
+        zh->auth.completion = 0;
+    }
+    zoo_unlock_auth(zh);
+
+    if (auth_completion) {
+        auth_completion(reason, auth_data);
+    }
 }
 
 static void cleanup_bufs(zhandle_t *zh,int callCompletion,int rc)