]>
Commit | Line | Data |
---|---|---|
36aa8c36 JR |
1 | Index: squid3/src/ftp.cc |
2 | diff -c squid3/src/ftp.cc:1.354 squid3/src/ftp.cc:1.355 | |
3 | *** squid3/src/ftp.cc:1.354 Sun Aug 31 21:49:38 2003 | |
4 | --- squid3/src/ftp.cc Sun Sep 7 10:53:37 2003 | |
5 | *************** | |
6 | *** 1135,1178 **** | |
7 | } | |
8 | ||
9 | static void | |
10 | ! ftpDataRead(int fd, char *buf, size_t len, comm_err_t flag, int xerrno, void *data) | |
11 | { | |
12 | FtpStateData *ftpState = (FtpStateData *)data; | |
13 | int j; | |
14 | int bin; | |
15 | StoreEntry *entry = ftpState->entry; | |
16 | size_t read_sz; | |
17 | - #if DELAY_POOLS | |
18 | ||
19 | ! DelayId delayId = entry->mem_obj->mostBytesAllowed(); | |
20 | ! #endif | |
21 | ||
22 | ! assert(fd == ftpState->data.fd); | |
23 | ! /* Bail out early on COMM_ERR_CLOSING - close handlers will tidy up for us | |
24 | ! */ | |
25 | ||
26 | ! if (flag == COMM_ERR_CLOSING) { | |
27 | return; | |
28 | ! } | |
29 | ||
30 | if (EBIT_TEST(entry->flags, ENTRY_ABORTED)) { | |
31 | comm_close(ftpState->ctrl.fd); | |
32 | return; | |
33 | } | |
34 | ||
35 | ! if (flag == COMM_OK && len > 0) { | |
36 | #if DELAY_POOLS | |
37 | delayId.bytesIn(len); | |
38 | #endif | |
39 | ||
40 | - kb_incr(&statCounter.server.all.kbytes_in, len); | |
41 | - kb_incr(&statCounter.server.ftp.kbytes_in, len); | |
42 | ftpState->data.offset += len; | |
43 | } | |
44 | ||
45 | - debug(9, 5) ("ftpDataRead: FD %d, Read %d bytes\n", fd, (unsigned int)len); | |
46 | ||
47 | ! if (flag == COMM_OK && len > 0) { | |
48 | IOStats.Ftp.reads++; | |
49 | ||
50 | for (j = len - 1, bin = 0; j; bin++) | |
51 | --- 1135,1181 ---- | |
52 | } | |
53 | ||
54 | static void | |
55 | ! ftpDataRead(int fd, char *buf, size_t len, comm_err_t errflag, int xerrno, void *data) | |
56 | { | |
57 | FtpStateData *ftpState = (FtpStateData *)data; | |
58 | int j; | |
59 | int bin; | |
60 | StoreEntry *entry = ftpState->entry; | |
61 | size_t read_sz; | |
62 | ||
63 | ! debug(9, 5) ("ftpDataRead: FD %d, Read %d bytes\n", fd, (unsigned int)len); | |
64 | ||
65 | ! if (len > 0) { | |
66 | ! kb_incr(&statCounter.server.all.kbytes_in, len); | |
67 | ! kb_incr(&statCounter.server.ftp.kbytes_in, len); | |
68 | ! } | |
69 | ||
70 | ! if (errflag == COMM_ERR_CLOSING) | |
71 | return; | |
72 | ! | |
73 | ! assert(fd == ftpState->data.fd); | |
74 | ! | |
75 | ! #if DELAY_POOLS | |
76 | ! | |
77 | ! DelayId delayId = entry->mem_obj->mostBytesAllowed(); | |
78 | ! | |
79 | ! #endif | |
80 | ||
81 | if (EBIT_TEST(entry->flags, ENTRY_ABORTED)) { | |
82 | comm_close(ftpState->ctrl.fd); | |
83 | return; | |
84 | } | |
85 | ||
86 | ! if (errflag == COMM_OK && len > 0) { | |
87 | #if DELAY_POOLS | |
88 | delayId.bytesIn(len); | |
89 | #endif | |
90 | ||
91 | ftpState->data.offset += len; | |
92 | } | |
93 | ||
94 | ||
95 | ! if (errflag == COMM_OK && len > 0) { | |
96 | IOStats.Ftp.reads++; | |
97 | ||
98 | for (j = len - 1, bin = 0; j; bin++) | |
99 | *************** | |
100 | *** 1185,1191 **** | |
101 | ftpListingStart(ftpState); | |
102 | } | |
103 | ||
104 | ! if (flag != COMM_OK || len < 0) { | |
105 | debug(50, ignoreErrno(xerrno) ? 3 : 1) ("ftpDataRead: read error: %s\n", xstrerr(xerrno)); | |
106 | ||
107 | if (ignoreErrno(xerrno)) { | |
108 | --- 1188,1194 ---- | |
109 | ftpListingStart(ftpState); | |
110 | } | |
111 | ||
112 | ! if (errflag != COMM_OK || len < 0) { | |
113 | debug(50, ignoreErrno(xerrno) ? 3 : 1) ("ftpDataRead: read error: %s\n", xstrerr(xerrno)); | |
114 | ||
115 | if (ignoreErrno(xerrno)) { | |
116 | *************** | |
117 | *** 1578,1595 **** | |
118 | } | |
119 | ||
120 | static void | |
121 | ! ftpReadControlReply(int fd, char *buf, size_t len, comm_err_t flag, int xerrno, void *data) | |
122 | { | |
123 | FtpStateData *ftpState = (FtpStateData *)data; | |
124 | StoreEntry *entry = ftpState->entry; | |
125 | ! debug(9, 5) ("ftpReadControlReply\n"); | |
126 | ||
127 | ! /* Bail out early on COMM_ERR_CLOSING - close handlers will tidy up for us | |
128 | ! */ | |
129 | ||
130 | ! if (flag == COMM_ERR_CLOSING) { | |
131 | return; | |
132 | - } | |
133 | ||
134 | if (EBIT_TEST(entry->flags, ENTRY_ABORTED)) { | |
135 | comm_close(ftpState->ctrl.fd); | |
136 | --- 1581,1599 ---- | |
137 | } | |
138 | ||
139 | static void | |
140 | ! ftpReadControlReply(int fd, char *buf, size_t len, comm_err_t errflag, int xerrno, void *data) | |
141 | { | |
142 | FtpStateData *ftpState = (FtpStateData *)data; | |
143 | StoreEntry *entry = ftpState->entry; | |
144 | ! debug(9, 5) ("ftpReadControlReply: FD %d, Read %d bytes\n", fd, (int)len); | |
145 | ||
146 | ! if (len > 0) { | |
147 | ! kb_incr(&statCounter.server.all.kbytes_in, len); | |
148 | ! kb_incr(&statCounter.server.ftp.kbytes_in, len); | |
149 | ! } | |
150 | ||
151 | ! if (errflag == COMM_ERR_CLOSING) | |
152 | return; | |
153 | ||
154 | if (EBIT_TEST(entry->flags, ENTRY_ABORTED)) { | |
155 | comm_close(ftpState->ctrl.fd); | |
156 | *************** | |
157 | *** 1598,1612 **** | |
158 | ||
159 | assert(ftpState->ctrl.offset < (off_t)ftpState->ctrl.size); | |
160 | ||
161 | ! if (flag == COMM_OK && len > 0) { | |
162 | fd_bytes(fd, len, FD_READ); | |
163 | - kb_incr(&statCounter.server.all.kbytes_in, len); | |
164 | - kb_incr(&statCounter.server.ftp.kbytes_in, len); | |
165 | } | |
166 | ||
167 | - debug(9, 5) ("ftpReadControlReply: FD %d, Read %d bytes\n", fd, (int)len); | |
168 | ||
169 | ! if (flag != COMM_OK || len < 0) { | |
170 | debug(50, ignoreErrno(xerrno) ? 3 : 1) ("ftpReadControlReply: read error: %s\n", xstrerr(xerrno)); | |
171 | ||
172 | if (ignoreErrno(xerrno)) { | |
173 | --- 1602,1613 ---- | |
174 | ||
175 | assert(ftpState->ctrl.offset < (off_t)ftpState->ctrl.size); | |
176 | ||
177 | ! if (errflag == COMM_OK && len > 0) { | |
178 | fd_bytes(fd, len, FD_READ); | |
179 | } | |
180 | ||
181 | ||
182 | ! if (errflag != COMM_OK || len < 0) { | |
183 | debug(50, ignoreErrno(xerrno) ? 3 : 1) ("ftpReadControlReply: read error: %s\n", xstrerr(xerrno)); | |
184 | ||
185 | if (ignoreErrno(xerrno)) { | |
186 | *************** | |
187 | *** 2364,2372 **** | |
188 | FtpStateData *ftpState = (FtpStateData *)data; | |
189 | debug(9, 3) ("ftpAcceptDataConnection\n"); | |
190 | ||
191 | ! if (flag == COMM_ERR_CLOSING) { | |
192 | return; | |
193 | - } | |
194 | ||
195 | if (EBIT_TEST(ftpState->entry->flags, ENTRY_ABORTED)) { | |
196 | comm_close(ftpState->ctrl.fd); | |
197 | --- 2365,2372 ---- | |
198 | FtpStateData *ftpState = (FtpStateData *)data; | |
199 | debug(9, 3) ("ftpAcceptDataConnection\n"); | |
200 | ||
201 | ! if (flag == COMM_ERR_CLOSING) | |
202 | return; | |
203 | ||
204 | if (EBIT_TEST(ftpState->entry->flags, ENTRY_ABORTED)) { | |
205 | comm_close(ftpState->ctrl.fd); |