aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcorvid <devnull@localhost>2014-08-08 01:14:52 +0000
committercorvid <devnull@localhost>2014-08-08 01:14:52 +0000
commitffb8100ff3222e8aa11bd33a7c1ea7342f2c6aea (patch)
treebcb85bba820a9580b76259cd42ebaa91b87073d7
parent0553cb9e777357d8d25819735503f3251198c27c (diff)
abort failed queries
http://lists.dillo.org/pipermail/dillo-dev/2014-July/010190.html and no one objected, and it hasn't given me any trouble, so...
-rw-r--r--src/IO/IO.c9
-rw-r--r--src/IO/http.c8
-rw-r--r--src/cache.c13
-rw-r--r--src/capi.c1
4 files changed, 29 insertions, 2 deletions
diff --git a/src/IO/IO.c b/src/IO/IO.c
index 43a3ff3a..0addf486 100644
--- a/src/IO/IO.c
+++ b/src/IO/IO.c
@@ -298,6 +298,8 @@ static void IO_fd_write_cb(int fd, void *data)
} else {
if (IO_callback(io) == 0)
a_IOwatch_remove_fd(fd, DIO_WRITE);
+ if (io->Status)
+ a_IO_ccc(OpAbort, 1, FWD, io->Info, NULL, NULL);
}
}
@@ -385,6 +387,13 @@ void a_IO_ccc(int Op, int Branch, int Dir, ChainLink *Info,
} else { /* 1 FWD */
/* Write-data status */
switch (Op) {
+ case OpAbort:
+ io = Info->LocalKey;
+ IO_close_fd(io, IO_StopRdWr);
+ IO_free(io);
+ a_Chain_fcb(OpAbort, Info, NULL, NULL);
+ dFree(Info);
+ break;
default:
MSG_WARN("Unused CCC\n");
break;
diff --git a/src/IO/http.c b/src/IO/http.c
index 68294fb4..d5664fb2 100644
--- a/src/IO/http.c
+++ b/src/IO/http.c
@@ -696,8 +696,16 @@ void a_Http_ccc(int Op, int Branch, int Dir, ChainLink *Info,
break;
}
} else { /* 1 FWD */
+ SocketData_t *sd;
/* HTTP send-query status branch */
switch (Op) {
+ case OpAbort:
+ if ((sd = a_Klist_get_data(ValidSocks, SKey)))
+ MSG_BW(sd->web, 1, "Can't get %s", URL_STR(sd->web->url));
+ a_Chain_fcb(OpAbort, Info, NULL, "Both");
+ Http_socket_free(SKey);
+ dFree(Info);
+ break;
default:
MSG_WARN("Unused CCC\n");
break;
diff --git a/src/cache.c b/src/cache.c
index 4b216c55..d28faa7a 100644
--- a/src/cache.c
+++ b/src/cache.c
@@ -974,8 +974,17 @@ bool_t a_Cache_process_dbuf(int Op, const char *buf, size_t buf_size,
} else if (Op == IOClose) {
Cache_finish_msg(entry);
} else if (Op == IOAbort) {
- /* unused */
- MSG("a_Cache_process_dbuf Op = IOAbort; not implemented!\n");
+ int i;
+ CacheClient_t *Client;
+
+ for (i = 0; (Client = dList_nth_data(ClientQueue, i)); ++i) {
+ if (Client->Url == entry->Url) {
+ DilloWeb *web = (DilloWeb *)Client->Web;
+
+ a_Bw_remove_client(web->bw, Client->Key);
+ Cache_client_dequeue(Client);
+ }
+ }
}
return done;
}
diff --git a/src/capi.c b/src/capi.c
index 1f4de0d9..71faf5b9 100644
--- a/src/capi.c
+++ b/src/capi.c
@@ -681,6 +681,7 @@ void a_Capi_ccc(int Op, int Branch, int Dir, ChainLink *Info,
case OpAbort:
conn = Info->LocalKey;
conn->InfoSend = NULL;
+ a_Cache_process_dbuf(IOAbort, NULL, 0, conn->url);
if (Data2) {
if (!strcmp(Data2, "DpidERROR")) {
a_UIcmd_set_msg(conn->bw,