From 12158bdc66a72b40cb881f57cc7db3aeae27ef12 Mon Sep 17 00:00:00 2001 From: wessels <> Date: Thu, 21 Jan 1999 02:27:08 +0000 Subject: [PATCH] Fixed up *Timeout() functions. We might get fooTimeout() called when the entry has been ENTRY_ABORTED because the abort callback comes in an event, not immediately. Also, fooTimeout() now uses fwdFail instead of building its own error page. --- src/ftp.cc | 16 +++++++--------- src/gopher.cc | 14 +++++++------- src/http.cc | 11 ++++++----- src/wais.cc | 12 +++++++----- 4 files changed, 27 insertions(+), 26 deletions(-) diff --git a/src/ftp.cc b/src/ftp.cc index c902d00d94..785e74ee11 100644 --- a/src/ftp.cc +++ b/src/ftp.cc @@ -1,6 +1,6 @@ /* - * $Id: ftp.cc,v 1.270 1999/01/20 03:02:48 wessels Exp $ + * $Id: ftp.cc,v 1.271 1999/01/20 19:27:08 wessels Exp $ * * DEBUG: section 9 File Transfer Protocol (FTP) * AUTHOR: Harvest Derived @@ -318,15 +318,13 @@ ftpTimeout(int fd, void *data) { FtpStateData *ftpState = data; StoreEntry *entry = ftpState->entry; - ErrorState *err; debug(9, 4) ("ftpTimeout: FD %d: '%s'\n", fd, storeUrl(entry)); - if (entry->store_status == STORE_PENDING) { - if (entry->mem_obj->inmem_hi == 0) { - err = errorCon(ERR_READ_TIMEOUT, HTTP_GATEWAY_TIMEOUT); - err->request = requestLink(ftpState->request); - errorAppendEntry(entry, err); - } - } + if (entry->store_status == STORE_PENDING) { + if (entry->mem_obj->inmem_hi == 0) { + fwdFail(ftpState->fwd, + errorCon(ERR_READ_TIMEOUT, HTTP_GATEWAY_TIMEOUT)); + } + } if (ftpState->data.fd > -1) { comm_close(ftpState->data.fd); ftpState->data.fd = -1; diff --git a/src/gopher.cc b/src/gopher.cc index 2d7da885a2..888b6179aa 100644 --- a/src/gopher.cc +++ b/src/gopher.cc @@ -1,7 +1,7 @@ /* - * $Id: gopher.cc,v 1.147 1999/01/19 02:24:26 wessels Exp $ + * $Id: gopher.cc,v 1.148 1999/01/20 19:27:11 wessels Exp $ * * DEBUG: section 10 Gopher * AUTHOR: Harvest Derived @@ -575,13 +575,13 @@ gopherTimeout(int fd, void *data) { GopherStateData *gopherState = data; StoreEntry *entry = gopherState->entry; - ErrorState *err; debug(10, 4) ("gopherTimeout: FD %d: '%s'\n", fd, storeUrl(entry)); - if (entry->mem_obj->inmem_hi == 0) { - err = errorCon(ERR_READ_TIMEOUT, HTTP_GATEWAY_TIMEOUT); - err->url = xstrdup(gopherState->request); - errorAppendEntry(entry, err); - } + if (entry->store_status == STORE_PENDING) { + if (entry->mem_obj->inmem_hi == 0) { + fwdFail(gopherState->fwdState, + errorCon(ERR_READ_TIMEOUT, HTTP_GATEWAY_TIMEOUT)); + } + } comm_close(fd); } diff --git a/src/http.cc b/src/http.cc index 2156ad6bfd..60b1768916 100644 --- a/src/http.cc +++ b/src/http.cc @@ -1,6 +1,6 @@ /* - * $Id: http.cc,v 1.343 1999/01/19 23:17:58 wessels Exp $ + * $Id: http.cc,v 1.344 1999/01/20 19:27:10 wessels Exp $ * * DEBUG: section 11 Hypertext Transfer Protocol (HTTP) * AUTHOR: Harvest Derived @@ -90,10 +90,11 @@ httpTimeout(int fd, void *data) HttpStateData *httpState = data; StoreEntry *entry = httpState->entry; debug(11, 4) ("httpTimeout: FD %d: '%s'\n", fd, storeUrl(entry)); - assert(entry->store_status == STORE_PENDING); - if (entry->mem_obj->inmem_hi == 0) { - fwdFail(httpState->fwd, - errorCon(ERR_READ_TIMEOUT, HTTP_GATEWAY_TIMEOUT)); + if (entry->store_status == STORE_PENDING) { + if (entry->mem_obj->inmem_hi == 0) { + fwdFail(httpState->fwd, + errorCon(ERR_READ_TIMEOUT, HTTP_GATEWAY_TIMEOUT)); + } } comm_close(fd); } diff --git a/src/wais.cc b/src/wais.cc index fd50dded45..68a683dbf9 100644 --- a/src/wais.cc +++ b/src/wais.cc @@ -1,6 +1,6 @@ /* - * $Id: wais.cc,v 1.129 1999/01/19 02:24:36 wessels Exp $ + * $Id: wais.cc,v 1.130 1999/01/20 19:27:12 wessels Exp $ * * DEBUG: section 24 WAIS Relay * AUTHOR: Harvest Derived @@ -67,12 +67,14 @@ static void waisTimeout(int fd, void *data) { WaisStateData *waisState = data; - ErrorState *err; StoreEntry *entry = waisState->entry; debug(24, 4) ("waisTimeout: FD %d: '%s'\n", fd, storeUrl(entry)); - err = errorCon(ERR_READ_TIMEOUT, HTTP_GATEWAY_TIMEOUT); - err->request = requestLink(waisState->request); - errorAppendEntry(entry, err); + if (entry->store_status == STORE_PENDING) { + if (entry->mem_obj->inmem_hi == 0) { + fwdFail(waisState->fwd, + errorCon(ERR_READ_TIMEOUT, HTTP_GATEWAY_TIMEOUT)); + } + } comm_close(fd); } -- 2.39.2