summaryrefslogtreecommitdiff
path: root/src/capi.c
diff options
context:
space:
mode:
authorJorge Arellano Cid <jcid@dillo.org>2009-08-18 14:32:27 -0400
committerJorge Arellano Cid <jcid@dillo.org>2009-08-18 14:32:27 -0400
commit1751256d631e1894685aa2443e7479fb8f8fff0f (patch)
tree2e42b9940276c34e6b3d35ef584bdb8cc337ef0d /src/capi.c
parent0ca1f75562517a6c531d2339f201dfcacd799654 (diff)
Remove empty cache entries on Stop-button press and new link request!
Diffstat (limited to 'src/capi.c')
-rw-r--r--src/capi.c11
1 files changed, 8 insertions, 3 deletions
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;