]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
- Also move reply list clean for mesh callbacks to the scrip callback
authorW.C.A. Wijngaards <wouter@nlnetlabs.nl>
Tue, 30 Jun 2020 13:48:11 +0000 (15:48 +0200)
committerW.C.A. Wijngaards <wouter@nlnetlabs.nl>
Tue, 30 Jun 2020 13:48:11 +0000 (15:48 +0200)
  can see the reply_info.
- Fix for mesh accounting if the reply list already empty to begin
  with.

doc/Changelog
services/mesh.c

index 197e4b29bfe2581ba6d8756d87107c5749216310..64e1f50aab9b067bcf4a22990896dc89112d27b8 100644 (file)
@@ -1,6 +1,10 @@
 29 June 2020: Wouter
        - Move reply list clean for serve expired mesh callback to after
          the reply is sent, so that script callbacks have reply_info.
+       - Also move reply list clean for mesh callbacks to the scrip callback
+         can see the reply_info.
+       - Fix for mesh accounting if the reply list already empty to begin
+         with.
 
 24 June 2020: Wouter
        - iana portlist updated.
index 22341441502177adc2cdef9f9636665ee38585bb..b5d4aeeab4f3aeec3183a9925abd03b3c7a0b60d 100644 (file)
@@ -1320,26 +1320,7 @@ void mesh_query_done(struct mesh_state* mstate)
                        free(err);
                }
        }
-       if(mstate->reply_list) {
-               /* set the reply_list to NULL during the mesh_query_done
-                * processing, so that calls back into the mesh from
-                * tcp_req_info (deciding to drop the reply and thus
-                * unregister the mesh_reply from the mstate) are stopped
-                * because the list is empty.
-                * The mstate is then likely not a reply_state, and maybe
-                * also a detached_state.
-                */
-               reply_list = mstate->reply_list;
-               mstate->reply_list = NULL;
-               if(!mstate->reply_list && !mstate->cb_list) {
-                       /* was a reply state, not anymore */
-                       log_assert(mstate->s.env->mesh->num_reply_states > 0);
-                       mstate->s.env->mesh->num_reply_states--;
-               }
-               if(!mstate->reply_list && !mstate->cb_list &&
-                       mstate->super_set.count == 0)
-                       mstate->s.env->mesh->num_detached_states++;
-       }
+       reply_list = mstate->reply_list;
        for(r = reply_list; r; r = r->next) {
                /* if a response-ip address block has been stored the
                 *  information should be logged for each client. */
@@ -1381,6 +1362,17 @@ void mesh_query_done(struct mesh_state* mstate)
                        prev_buffer = r_buffer;
                }
        }
+       if(mstate->reply_list) {
+               mstate->reply_list = NULL;
+               if(!mstate->reply_list && !mstate->cb_list) {
+                       /* was a reply state, not anymore */
+                       log_assert(mstate->s.env->mesh->num_reply_states > 0);
+                       mstate->s.env->mesh->num_reply_states--;
+               }
+               if(!mstate->reply_list && !mstate->cb_list &&
+                       mstate->super_set.count == 0)
+                       mstate->s.env->mesh->num_detached_states++;
+       }
        mstate->replies_sent = 1;
        while((c = mstate->cb_list) != NULL) {
                /* take this cb off the list; so that the list can be
@@ -1992,12 +1984,14 @@ mesh_serve_expired_callback(void* arg)
                mesh->ans_expired++;
 
        }
-       mstate->reply_list = NULL;
-       if(!mstate->reply_list && !mstate->cb_list && r) {
-               log_assert(mesh->num_reply_states > 0);
-               mesh->num_reply_states--;
-               if(mstate->super_set.count == 0) {
-                       mesh->num_detached_states++;
+       if(mstate->reply_list) {
+               mstate->reply_list = NULL;
+               if(!mstate->reply_list && !mstate->cb_list && r) {
+                       log_assert(mesh->num_reply_states > 0);
+                       mesh->num_reply_states--;
+                       if(mstate->super_set.count == 0) {
+                               mesh->num_detached_states++;
+                       }
                }
        }
        while((c = mstate->cb_list) != NULL) {