From a242c0021263fc48fa57d1e4c1a874713745f590 Mon Sep 17 00:00:00 2001 From: Jorge Arellano Cid Date: Thu, 1 Jan 2009 10:06:44 -0300 Subject: [mq]: dicache-cleanup4 --- src/dicache.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src/dicache.c') diff --git a/src/dicache.c b/src/dicache.c index 20893ed9..5dc0080f 100644 --- a/src/dicache.c +++ b/src/dicache.c @@ -266,10 +266,12 @@ void a_Dicache_callback(int Op, CacheClient_t *Client) 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 @@ void a_Dicache_close(DilloUrl *url, int version, CacheClient_t *Client) 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); } -- cgit v1.2.3