changeset 709:2e5f159ae6df

[mq]: dicache-cleanup4
author Jorge Arellano Cid <jcid@dillo.org>
date Thu, 01 Jan 2009 10:06:44 -0300
parents 697145062347
children 43e46533be39
files src/dicache.c
diffstat 1 files changed, 8 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/dicache.c	Mon Dec 29 12:36:52 2008 -0300
+++ b/src/dicache.c	Thu Jan 01 10:06:44 2009 -0300
@@ -266,10 +266,12 @@
    dReturn_if_fail ( DicEntry != NULL );
 
    /* Only call the decoder when necessary */
-   if (DicEntry->State < DIC_Close &&
+   if (Op == CA_Send && DicEntry->State < DIC_Close &&
        DicEntry->DecodedSize < Client->BufSize) {
       DicEntry->Decoder(Op, Client);
       DicEntry->DecodedSize = Client->BufSize; /* necessary ?? */
+   } else if (Op == CA_Close || Op == CA_Abort) {
+      a_Dicache_close(DicEntry->url, DicEntry->version, Client);
    }
 
    /* when the data stream is not an image 'v_imgbuf' remains NULL */
@@ -417,12 +419,16 @@
    DilloWeb *Web = Client->Web;
    DICacheEntry *DicEntry = Dicache_get_entry_version(url, version);
 
-   MSG("a_Dicache_close\n");
+   MSG("a_Dicache_close RefCount=%d\n", DicEntry->RefCount);
    dReturn_if_fail ( DicEntry != NULL );
 
    DicEntry->State = DIC_Close;
    dFree(DicEntry->cmap);
    DicEntry->cmap = NULL;
+   DicEntry->Decoder = NULL;
+   DicEntry->DecoderData = NULL;
+   a_Dicache_unref(url, version);
+
    a_Bw_close_client(Web->bw, Client->Key);
 }