aboutsummaryrefslogtreecommitdiff
path: root/src/capi.c
diff options
context:
space:
mode:
authorcorvid <devnull@localhost>2014-09-05 08:57:00 +0000
committercorvid <devnull@localhost>2014-09-05 08:57:00 +0000
commit379c752f815d4e89174841041421136be3178283 (patch)
treea868e78b0b1f9f4f36696c31f358975c2d0adca3 /src/capi.c
parentf69356b013d118f6f1e493a57bdc35bef6330cd1 (diff)
persistent connections: reply complete only if cache didn't abort
I'm amazed that it took me something like six months to encounter this case.
Diffstat (limited to 'src/capi.c')
-rw-r--r--src/capi.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/capi.c b/src/capi.c
index 71faf5b9..7524535b 100644
--- a/src/capi.c
+++ b/src/capi.c
@@ -750,8 +750,13 @@ void a_Capi_ccc(int Op, int Branch, int Dir, ChainLink *Info,
DataBuf *dbuf = Data1;
bool_t finished = a_Cache_process_dbuf(IORead, dbuf->Buf,
dbuf->Size, conn->url);
- if (finished)
- a_Chain_bcb(OpSend, Info, NULL, "reply_complete");
+ if (finished && Capi_conn_valid(conn) && conn->InfoRecv) {
+ /* If we have a persistent connection where cache tells us
+ * that we've received the full response, and cache didn't
+ * trigger an abort and tear everything down, tell upstream.
+ */
+ a_Chain_bcb(OpSend, conn->InfoRecv, NULL, "reply_complete");
+ }
} else if (strcmp(Data2, "send_status_message") == 0) {
a_UIcmd_set_msg(conn->bw, "%s", Data1);
} else if (strcmp(Data2, "chat") == 0) {