aboutsummaryrefslogtreecommitdiffstats
path: root/main/squid/bug3577.patch
blob: 35c97bd4b70cf15218c6df82e1db0b5e6e3d4fc4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
--- squid-3.2.0.18.orig/src/comm/ConnOpener.cc
+++ squid-3.2.0.18/src/comm/ConnOpener.cc
@@ -131,6 +131,7 @@
     }
 
     if (temporaryFd_ >= 0) {
+	debugs(5, 4, HERE << conn_ << " closing temp FD " << temporaryFd_);
         // it never reached fully open, so cleanup the FD handlers
         // Note that comm_close() sequence does not happen for partially open FD
         Comm::SetSelect(temporaryFd_, COMM_SELECT_WRITE, NULL, NULL, 0);
@@ -141,6 +142,7 @@
         }
         fd_table[temporaryFd_].timeoutHandler = NULL;
         fd_table[temporaryFd_].timeout = 0;
+        close(temporaryFd_);
         fd_close(temporaryFd_);
         temporaryFd_ = -1;
     }
--- squid-3.2.0.18.orig/src/forward.cc
+++ squid-3.2.0.18/src/forward.cc
@@ -84,6 +84,11 @@
 
     if (Comm::IsConnOpen(fwd->serverConnection())) {
         comm_remove_close_handler(fwd->serverConnection()->fd, fwdServerClosedWrapper, fwd);
+        debugs(17, 3, HERE << "store entry aborted; closing " <<
+               fwd->serverConnection());
+        fwd->serverConnection()->close();
+    } else {
+        debugs(17, 7, HERE << "store entry aborted; no connection to close");   
     }
     fwd->serverDestinations.clean();
     fwd->self = NULL;
--- squid-3.2.0.18.orig/src/http.cc
+++ squid-3.2.0.18/src/http.cc
@@ -1067,7 +1067,7 @@
     }
 
     if (EBIT_TEST(entry->flags, ENTRY_ABORTED)) {
-        // TODO: should we call abortTransaction() here?
+        abortTransaction("store entry aborted while reading reply");
         return;
     }
 
@@ -1346,12 +1346,9 @@
     }
 
     if (EBIT_TEST(entry->flags, ENTRY_ABORTED)) {
-        /*
-         * The above writeReplyBody() call could ABORT this entry,
-         * in that case, the server FD should already be closed.
-         * there's nothing for us to do.
-         */
-        (void) 0;
+        // The above writeReplyBody() call may have aborted the store entry.
+        abortTransaction("store entry aborted while storing reply");
+        return;    
     } else
         switch (persistentConnStatus()) {
         case INCOMPLETE_MSG: {