From 379c752f815d4e89174841041421136be3178283 Mon Sep 17 00:00:00 2001 From: corvid Date: Fri, 5 Sep 2014 08:57:00 +0000 Subject: 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. --- src/capi.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/capi.c') 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) { -- cgit v1.2.3