/* * Determine if two cache entries are equal, using a URL as key. */ static int Cache_entry_by_url_cmp(const void *v1, const void *v2) { const DilloUrl *u1 = ((CacheEntry_t*)v1)->Url; const DilloUrl *u2 = v2; return a_Url_cmp(u1, u2); }
/* * Abort the connection for a given url, using its CCC. * (OpAbort 2,BCK removes the cache entry) * TODO: when conn is already done, the cache entry isn't removed. * This may be wrong and needs a revision. */ void a_Capi_conn_abort_by_url(const DilloUrl *url) { int i; capi_conn_t *conn; for (i = 0; i < dList_length(CapiConns); ++i) { conn = dList_nth_data (CapiConns, i); if (a_Url_cmp(conn->url, url) == 0) { if (conn->InfoSend) { a_Capi_ccc(OpAbort, 1, BCK, conn->InfoSend, NULL, NULL); } if (conn->InfoRecv) { a_Capi_ccc(OpAbort, 2, BCK, conn->InfoRecv, NULL, NULL); } break; } } }
/* * Determine if two cache entries are equal (used by CachedURLs) */ static int Cache_entry_cmp(const void *v1, const void *v2) { const CacheEntry_t *d1 = v1, *d2 = v2; return a_Url_cmp(d1->Url, d2->Url); }