]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Replaced gross EBIT_SET(..., DELAY_SENDING) and EBIT_CLR(..., DELAY_SENDING)
authorwessels <>
Tue, 18 Nov 1997 08:02:37 +0000 (08:02 +0000)
committerwessels <>
Tue, 18 Nov 1997 08:02:37 +0000 (08:02 +0000)
with storeBuffer() and storeBufferFlush().

src/ftp.cc
src/gopher.cc
src/protos.h
src/stat.cc
src/store.cc

index 1cfeb4edbcd8156d117c10948e5cf1301b7a05eb..6ff24389d209d3b391ccc3a71d2e7c89729fd884 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: ftp.cc,v 1.170 1997/11/18 00:48:23 wessels Exp $
+ * $Id: ftp.cc,v 1.171 1997/11/18 01:02:37 wessels Exp $
  *
  * DEBUG: section 9     File Transfer Protocol (FTP)
  * AUTHOR: Harvest Derived
@@ -258,6 +258,7 @@ ftpListingStart(FtpStateData * ftpState)
 {
     StoreEntry *e = ftpState->entry;
     wordlist *w;
+    storeBuffer(e);
     storeAppendPrintf(e, "<!-- HTML listing generated by Squid %s -->\n",
        version_string);
     storeAppendPrintf(e, "<!-- %s -->\n", mkrfc1123(squid_curtime));
@@ -281,6 +282,7 @@ ftpListingStart(FtpStateData * ftpState)
     storeAppendPrintf(e, "FTP Directory: %s\n", ftpState->title_url);
     storeAppendPrintf(e, "</H2>\n");
     storeAppendPrintf(e, "<PRE>\n");
+    storeBufferFlush(e);
     EBIT_SET(ftpState->flags, FTP_HTML_HEADER_SENT);
 }
 
@@ -288,6 +290,7 @@ static void
 ftpListingFinish(FtpStateData * ftpState)
 {
     StoreEntry *e = ftpState->entry;
+    storeBuffer(e);
     storeAppendPrintf(e, "</PRE>\n");
     storeAppendPrintf(e, "<HR>\n");
     storeAppendPrintf(e, "<ADDRESS>\n");
@@ -297,6 +300,7 @@ ftpListingFinish(FtpStateData * ftpState)
        version_string,
        getMyHostname());
     storeAppendPrintf(e, "</ADDRESS></BODY></HTML>\n");
+    storeBufferFlush(e);
 }
 
 static const char *Month[] =
@@ -608,6 +612,7 @@ ftpParseListing(FtpStateData * ftpState, int len)
     end++;
     /* XXX there is an ABR bug here.   We need to make sure buf is
      * NULL terminated */
+    storeBuffer(e);
     for (s = buf; s < end; s += strcspn(s, crlf), s += strspn(s, crlf)) {
        linelen = strcspn(s, crlf) + 1;
        if (linelen > 4096)
@@ -620,6 +625,7 @@ ftpParseListing(FtpStateData * ftpState, int len)
        assert(t != NULL);
        storeAppend(e, t, strlen(t));
     }
+    storeBufferFlush(e);
     assert(usable <= len);
     if (usable < len) {
        /* must copy partial line to beginning of buf */
@@ -710,9 +716,7 @@ ftpReadData(int fd, void *data)
        ftpReadComplete(ftpState);
     } else {
        if (EBIT_TEST(ftpState->flags, FTP_ISDIR)) {
-           EBIT_SET(entry->flag, DELAY_SENDING);
            ftpParseListing(ftpState, len);
-           EBIT_CLR(entry->flag, DELAY_SENDING);
            InvokeHandlers(entry);
        } else {
            assert(ftpState->data.offset == 0);
@@ -1553,7 +1557,7 @@ ftpAppendSuccessHeader(FtpStateData * ftpState)
        mime_type = mimeGetContentType(filename);
        mime_enc = mimeGetContentEncoding(filename);
     }
-    EBIT_SET(e->flag, DELAY_SENDING);
+    storeBuffer(e);
     storeAppendPrintf(e, "HTTP/1.0 200 Gatewaying\r\n");
     reply->code = 200;
     reply->version = 1.0;
@@ -1575,8 +1579,8 @@ ftpAppendSuccessHeader(FtpStateData * ftpState)
        storeAppendPrintf(e, "Last-Modified: %s\r\n", mkrfc1123(ftpState->mdtm));
        reply->last_modified = ftpState->mdtm;
     }
-    EBIT_CLR(e->flag, DELAY_SENDING);
     storeAppendPrintf(e, "\r\n");
+    storeBufferFlush(e);
     reply->hdr_sz = e->mem_obj->inmem_hi;
     storeTimestampsSet(e);
     storeSetPublicKey(e);
index 4c91f6a421b59ea0cbe8a0cba48c6c8f2d6b656a..277cd9eb18f102735605fd0a3ac60b8960915166 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: gopher.cc,v 1.113 1997/11/14 17:21:19 wessels Exp $
+ * $Id: gopher.cc,v 1.114 1997/11/18 01:02:38 wessels Exp $
  *
  * DEBUG: section 10    Gopher
  * AUTHOR: Harvest Derived
@@ -371,7 +371,7 @@ gopherToHTML(GopherStateData * gopherState, char *inbuf, int len)
            "<ISINDEX></BODY></HTML>\n", storeUrl(entry), storeUrl(entry));
        storeAppend(entry, outbuf, strlen(outbuf));
        /* now let start sending stuff to client */
-       EBIT_CLR(entry->flag, DELAY_SENDING);
+       storeBufferFlush(entry);
        gopherState->data_in = 1;
 
        return;
@@ -387,7 +387,7 @@ gopherToHTML(GopherStateData * gopherState, char *inbuf, int len)
 
        storeAppend(entry, outbuf, strlen(outbuf));
        /* now let start sending stuff to client */
-       EBIT_CLR(entry->flag, DELAY_SENDING);
+       storeBufferFlush(entry);
        gopherState->data_in = 1;
 
        return;
@@ -635,7 +635,7 @@ gopherToHTML(GopherStateData * gopherState, char *inbuf, int len)
     if ((int) strlen(outbuf) > 0) {
        storeAppend(entry, outbuf, strlen(outbuf));
        /* now let start sending stuff to client */
-       EBIT_CLR(entry->flag, DELAY_SENDING);
+       storeBufferFlush(entry);
     }
     return;
 }
@@ -715,7 +715,7 @@ gopherReadReply(int fd, void *data)
        if (gopherState->conversion != NORMAL)
            gopherEndHTML(data);
        storeTimestampsSet(entry);
-       EBIT_CLR(entry->flag, DELAY_SENDING);
+       storeBufferFlush(entry);
        storeComplete(entry);
        comm_close(fd);
     } else {
@@ -765,19 +765,19 @@ gopherSendComplete(int fd, char *buf, size_t size, int errflag, void *data)
     switch (gopherState->type_id) {
     case GOPHER_DIRECTORY:
        /* we got to convert it first */
-       EBIT_SET(entry->flag, DELAY_SENDING);
+       storeBuffer(entry);
        gopherState->conversion = HTML_DIR;
        gopherState->HTML_header_added = 0;
        break;
     case GOPHER_INDEX:
        /* we got to convert it first */
-       EBIT_SET(entry->flag, DELAY_SENDING);
+       storeBuffer(entry);
        gopherState->conversion = HTML_INDEX_RESULT;
        gopherState->HTML_header_added = 0;
        break;
     case GOPHER_CSO:
        /* we got to convert it first */
-       EBIT_SET(entry->flag, DELAY_SENDING);
+       storeBuffer(entry);
        gopherState->conversion = HTML_CSO_RESULT;
        gopherState->cso_recno = 0;
        gopherState->HTML_header_added = 0;
index 6ea2b80f07a76cab9a9f685327a6a5c166076b8d..200471252d1a151b0230e4b38facdab2799433d8 100644 (file)
@@ -441,6 +441,8 @@ extern void storeMemObjectDump(MemObject * mem);
 extern const char *storeUrl(const StoreEntry *);
 extern void storeCreateMemObject(StoreEntry *, const char *, const char *);
 extern void storeCopyNotModifiedReplyHeaders(MemObject * O, MemObject * N);
+extern void storeBuffer(StoreEntry *);
+extern void storeBufferFlush(StoreEntry *);
 
 /* storeKey stuff */
 extern const cache_key *storeKeyDup(const cache_key *);
index dca48ba85b47e95888c6f8afe985312dd8e373c3..911cf7ec0bc029efb39b7d557fe5752f0286203f 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: stat.cc,v 1.173 1997/11/15 06:36:36 wessels Exp $
+ * $Id: stat.cc,v 1.174 1997/11/18 01:02:40 wessels Exp $
  *
  * DEBUG: section 18    Cache Manager Statistics
  * AUTHOR: Harvest Derived
@@ -329,7 +329,7 @@ statObjects(StoreEntry * sentry, int vm_or_not)
        if ((++N & 0xFF) == 0) {
            debug(18, 3) ("stat_objects_get:  Processed %d objects...\n", N);
        }
-       EBIT_SET(sentry->flag, DELAY_SENDING);
+       storeBuffer(sentry);
        storeAppendPrintf(sentry, "KEY %s\n", storeKeyText(entry->key));
        storeAppendPrintf(sentry, "\t%s %s\n",
            RequestMethodStr[entry->method], storeUrl(entry));
@@ -364,8 +364,8 @@ statObjects(StoreEntry * sentry, int vm_or_not)
            storeAppendPrintf(sentry, "\t\tswapin_fd: %d\n",
                (int) sc->swapin_fd);
        }
-       EBIT_CLR(sentry->flag, DELAY_SENDING);
        storeAppendPrintf(sentry, "\n");
+       storeBufferFlush(sentry);
     }
 }
 
@@ -975,7 +975,7 @@ statAvgDump(StoreEntry * sentry)
        A.select_loops /= N;
        A.cputime /= N;
     }
-    EBIT_SET(sentry->flag, DELAY_SENDING);
+    storeBuffer(sentry);
     storeAppendPrintf(sentry, "client_http.requests = %d\n", A.client_http.requests);
     storeAppendPrintf(sentry, "client_http.hits = %d\n", A.client_http.hits);
     storeAppendPrintf(sentry, "client_http.errors = %d\n", A.client_http.errors);
@@ -988,6 +988,6 @@ statAvgDump(StoreEntry * sentry)
     storeAppendPrintf(sentry, "unlink.requests = %d\n", A.unlink.requests);
     storeAppendPrintf(sentry, "page_faults = %d\n", A.page_faults);
     storeAppendPrintf(sentry, "select_loops = %d\n", A.select_loops);
-    EBIT_CLR(sentry->flag, DELAY_SENDING);
     storeAppendPrintf(sentry, "cputime = %f seconds\n", A.cputime);
+    storeBufferFlush(sentry);
 }
index dd8787a236f6c1a1cc04ae4b88590b97e6afc707..33e95135e6c4ebaf8f426913c3e1798bdabe71da 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: store.cc,v 1.345 1997/11/18 00:48:46 wessels Exp $
+ * $Id: store.cc,v 1.346 1997/11/18 01:02:42 wessels Exp $
  *
  * DEBUG: section 20    Storeage Manager
  * AUTHOR: Harvest Derived
@@ -2375,3 +2375,18 @@ storeCopyNotModifiedReplyHeaders(MemObject * oldmem, MemObject * newmem)
     if (newreply->expires > -1)
        oldreply->expires = newreply->expires;
 }
+
+/* this just sets DELAY_SENDING */
+void
+storeBuffer(StoreEntry *e)
+{
+       EBIT_SET(e->flag, DELAY_SENDING);
+}
+
+/* this just clears DELAY_SENDING and Invokes the handlers */
+void
+storeBufferFlush(StoreEntry *e)
+{
+       EBIT_CLR(e->flag, DELAY_SENDING);
+       InvokeHandlers(e);
+}