]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
rename ioqversion -> generation; move increment before fstrm_iothr_destroy
authorMark Andrews <marka@isc.org>
Thu, 25 Aug 2016 02:06:00 +0000 (22:06 -0400)
committerMark Andrews <marka@isc.org>
Thu, 25 Aug 2016 02:07:34 +0000 (12:07 +1000)
(cherry picked from commit 7535dd93a14b094ebe4d9c81a8ae28e2a100b7bf)

lib/dns/dnstap.c

index c6cc2cdedcb7f06be8f113fa8b53535c6cd9f02b..f08e7fbca0f3697eac73d651386cf7ed09e118d1 100644 (file)
@@ -122,7 +122,7 @@ static isc_mem_t *dt_mctx = NULL;
 /*
  * Change under task exclusive.
  */
-static unsigned int ioqversion;
+static unsigned int generation;
 
 static void
 mutex_init(void) {
@@ -189,7 +189,7 @@ dns_dt_create(isc_mem_t *mctx, dns_dtmode_t mode, const char *path,
                      DNS_LOGMODULE_DNSTAP, ISC_LOG_INFO,
                      "opening dnstap destination '%s'", path);
 
-       ioqversion++;
+       generation++;
 
        env = isc_mem_get(mctx, sizeof(dns_dtenv_t));
        if (env == NULL)
@@ -326,12 +326,12 @@ dns_dt_reopen(dns_dtenv_t *env, int roll) {
                      "%s dnstap destination '%s'",
                      (roll < 0) ? "reopening" : "rolling",
                      env->path);
+
+       generation++;
        
        if (env->iothr != NULL)
                fstrm_iothr_destroy(&env->iothr);
 
-       ioqversion++;
-
        if (env->mode == dns_dtmode_file && roll >= 0) {
                /*
                 * Create a temporary isc_logfile_t structure so we can
@@ -415,7 +415,7 @@ static struct fstrm_iothr_queue *
 dt_queue(dns_dtenv_t *env) {
        isc_result_t result;
        struct ioq {
-               unsigned int ioqversion;
+               unsigned int generation;
                struct fstrm_iothr_queue *ioq;
        } *ioq;
 
@@ -429,7 +429,7 @@ dt_queue(dns_dtenv_t *env) {
                return (NULL);
 
        ioq = (struct ioq *)isc_thread_key_getspecific(dt_key);
-       if (ioq != NULL && ioq->ioqversion != ioqversion) {
+       if (ioq != NULL && ioq->generation != generation) {
                result = isc_thread_key_setspecific(dt_key, NULL);
                if (result != ISC_R_SUCCESS)
                        return (NULL);
@@ -440,7 +440,7 @@ dt_queue(dns_dtenv_t *env) {
                ioq = malloc(sizeof(*ioq));
                if (ioq == NULL)
                        return (NULL);
-               ioq->ioqversion = ioqversion;
+               ioq->generation = generation;
                ioq->ioq = fstrm_iothr_get_input_queue(env->iothr);
                if (ioq->ioq == NULL) {
                        free(ioq);
@@ -484,7 +484,7 @@ destroy(dns_dtenv_t *env) {
                      "closing dnstap");
        env->magic = 0;
 
-       ioqversion++;
+       generation++;
 
        if (env->iothr != NULL)
                fstrm_iothr_destroy(&env->iothr);