summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/cache.c1
-rw-r--r--src/capi.c11
2 files changed, 8 insertions, 4 deletions
diff --git a/src/cache.c b/src/cache.c
index baf5505c..b984766b 100644
--- a/src/cache.c
+++ b/src/cache.c
@@ -1180,7 +1180,6 @@ static CacheEntry_t *Cache_process_queue(CacheEntry_t *entry)
/* Abort the entry, remove it from cache, and maybe offer download. */
DilloUrl *url = a_Url_dup(entry->Url);
a_Capi_conn_abort_by_url(url);
- Cache_entry_remove(entry, NULL);
entry = NULL;
if (OfferDownload && Cache_download_enabled(url)) {
a_UIcmd_save_link(Client_bw, url);
diff --git a/src/capi.c b/src/capi.c
index 866117b1..b3269ba8 100644
--- a/src/capi.c
+++ b/src/capi.c
@@ -184,6 +184,7 @@ static void Capi_conn_resume(void)
/*
* Abort the connection for a given url, using its CCC.
+ * (OpAbort 2,BCK removes the cache entry)
*/
void a_Capi_conn_abort_by_url(const DilloUrl *url)
{
@@ -515,7 +516,11 @@ void a_Capi_stop_client(int Key, int force)
{
CacheClient_t *Client;
- if (force && (Client = a_Cache_client_get_if_unique(Key))) {
+ _MSG("a_Capi_stop_client: force=%d\n", force);
+
+ Client = a_Cache_client_get_if_unique(Key);
+ if (Client && (force || Client->BufSize == 0)) {
+ /* remove empty entries too */
a_Capi_conn_abort_by_url(Client->Url);
}
a_Cache_stop_client(Key);
@@ -590,8 +595,6 @@ void a_Capi_ccc(int Op, int Branch, int Dir, ChainLink *Info,
case OpAbort:
conn = Info->LocalKey;
conn->InfoSend = NULL;
- /* remove the cache entry for this URL */
- a_Cache_entry_remove_by_url(conn->url);
if (Data2) {
if (!strcmp(Data2, "DpidERROR")) {
a_UIcmd_set_msg(conn->bw,
@@ -638,6 +641,8 @@ void a_Capi_ccc(int Op, int Branch, int Dir, ChainLink *Info,
conn = Info->LocalKey;
conn->InfoRecv = NULL;
a_Chain_bcb(OpAbort, Info, NULL, NULL);
+ /* remove the cache entry for this URL */
+ a_Cache_entry_remove_by_url(conn->url);
Capi_conn_unref(conn);
dFree(Info);
break;