]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
Fixup race.
authorWouter Wijngaards <wouter@nlnetlabs.nl>
Fri, 25 Jan 2008 10:23:57 +0000 (10:23 +0000)
committerWouter Wijngaards <wouter@nlnetlabs.nl>
Fri, 25 Jan 2008 10:23:57 +0000 (10:23 +0000)
git-svn-id: file:///svn/unbound/trunk@897 be551aaa-1e26-0410-a405-d3ace91eadb9

doc/Changelog
libunbound/unbound.c
libunbound/worker.c

index f286979dfdf78646b4d2dd96b02a124a9f58be41..373aa6613aba3be93764644208d9a7dc8e6d63a0 100644 (file)
@@ -1,6 +1,8 @@
 25 January 2008: Wouter
        - added tpkg for asynclook and library use. 
        - allows localhost to be queried when as a library.
+       - fixup race condition between cancel and answer (in case of
+         really fast answers that beat the cancel).
 
 24 January 2008: Wouter
        - tested the cancel() function.
index a3fcf95c32cdb4be26872fe510fc98367fe42fdc..aab29f521541636b68383c4621635dfea0488cf8 100644 (file)
@@ -377,7 +377,9 @@ process_answer(struct ub_val_ctx* ctx, uint8_t* msg, uint32_t len)
        q = context_deserialize_answer(ctx, msg, len, &err);
        if(!q) {
                lock_basic_unlock(&ctx->cfglock);
-               return 0;
+               /* probably simply the lookup that failed, i.e.
+                * response returned before cancel was sent out, so noerror */
+               return 1;
        }
        log_assert(q->async);
 
index 9f35b6d8cbb37e638d462f0fe2a23e94f997ecde..4af41b1982cbf6d187d0567e4bd9781f1a390524 100644 (file)
@@ -166,7 +166,8 @@ handle_cancel(struct libworker* w, uint8_t* buf, uint32_t len)
 {
        struct ctx_query* q = context_deserialize_cancel(w->ctx, buf, len);
        if(!q) {
-               log_err("deserialize cancel failed");
+               /* probably simply lookup failed, i.e. the message had been
+                * processed and answered before the cancel arrived */
                return;
        }
        q->cancelled = 1;