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
10 ! ftpDataRead(int fd, char *buf, size_t len, comm_err_t flag, int xerrno, void *data)
12 FtpStateData *ftpState = (FtpStateData *)data;
15 StoreEntry *entry = ftpState->entry;
19 ! DelayId delayId = entry->mem_obj->mostBytesAllowed();
22 ! assert(fd == ftpState->data.fd);
23 ! /* Bail out early on COMM_ERR_CLOSING - close handlers will tidy up for us
26 ! if (flag == COMM_ERR_CLOSING) {
30 if (EBIT_TEST(entry->flags, ENTRY_ABORTED)) {
31 comm_close(ftpState->ctrl.fd);
35 ! if (flag == COMM_OK && len > 0) {
40 - kb_incr(&statCounter.server.all.kbytes_in, len);
41 - kb_incr(&statCounter.server.ftp.kbytes_in, len);
42 ftpState->data.offset += len;
45 - debug(9, 5) ("ftpDataRead: FD %d, Read %d bytes\n", fd, (unsigned int)len);
47 ! if (flag == COMM_OK && len > 0) {
50 for (j = len - 1, bin = 0; j; bin++)
55 ! ftpDataRead(int fd, char *buf, size_t len, comm_err_t errflag, int xerrno, void *data)
57 FtpStateData *ftpState = (FtpStateData *)data;
60 StoreEntry *entry = ftpState->entry;
63 ! debug(9, 5) ("ftpDataRead: FD %d, Read %d bytes\n", fd, (unsigned int)len);
66 ! kb_incr(&statCounter.server.all.kbytes_in, len);
67 ! kb_incr(&statCounter.server.ftp.kbytes_in, len);
70 ! if (errflag == COMM_ERR_CLOSING)
73 ! assert(fd == ftpState->data.fd);
77 ! DelayId delayId = entry->mem_obj->mostBytesAllowed();
81 if (EBIT_TEST(entry->flags, ENTRY_ABORTED)) {
82 comm_close(ftpState->ctrl.fd);
86 ! if (errflag == COMM_OK && len > 0) {
91 ftpState->data.offset += len;
95 ! if (errflag == COMM_OK && len > 0) {
98 for (j = len - 1, bin = 0; j; bin++)
101 ftpListingStart(ftpState);
104 ! if (flag != COMM_OK || len < 0) {
105 debug(50, ignoreErrno(xerrno) ? 3 : 1) ("ftpDataRead: read error: %s\n", xstrerr(xerrno));
107 if (ignoreErrno(xerrno)) {
109 ftpListingStart(ftpState);
112 ! if (errflag != COMM_OK || len < 0) {
113 debug(50, ignoreErrno(xerrno) ? 3 : 1) ("ftpDataRead: read error: %s\n", xstrerr(xerrno));
115 if (ignoreErrno(xerrno)) {
121 ! ftpReadControlReply(int fd, char *buf, size_t len, comm_err_t flag, int xerrno, void *data)
123 FtpStateData *ftpState = (FtpStateData *)data;
124 StoreEntry *entry = ftpState->entry;
125 ! debug(9, 5) ("ftpReadControlReply\n");
127 ! /* Bail out early on COMM_ERR_CLOSING - close handlers will tidy up for us
130 ! if (flag == COMM_ERR_CLOSING) {
134 if (EBIT_TEST(entry->flags, ENTRY_ABORTED)) {
135 comm_close(ftpState->ctrl.fd);
140 ! ftpReadControlReply(int fd, char *buf, size_t len, comm_err_t errflag, int xerrno, void *data)
142 FtpStateData *ftpState = (FtpStateData *)data;
143 StoreEntry *entry = ftpState->entry;
144 ! debug(9, 5) ("ftpReadControlReply: FD %d, Read %d bytes\n", fd, (int)len);
147 ! kb_incr(&statCounter.server.all.kbytes_in, len);
148 ! kb_incr(&statCounter.server.ftp.kbytes_in, len);
151 ! if (errflag == COMM_ERR_CLOSING)
154 if (EBIT_TEST(entry->flags, ENTRY_ABORTED)) {
155 comm_close(ftpState->ctrl.fd);
159 assert(ftpState->ctrl.offset < (off_t)ftpState->ctrl.size);
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);
167 - debug(9, 5) ("ftpReadControlReply: FD %d, Read %d bytes\n", fd, (int)len);
169 ! if (flag != COMM_OK || len < 0) {
170 debug(50, ignoreErrno(xerrno) ? 3 : 1) ("ftpReadControlReply: read error: %s\n", xstrerr(xerrno));
172 if (ignoreErrno(xerrno)) {
175 assert(ftpState->ctrl.offset < (off_t)ftpState->ctrl.size);
177 ! if (errflag == COMM_OK && len > 0) {
178 fd_bytes(fd, len, FD_READ);
182 ! if (errflag != COMM_OK || len < 0) {
183 debug(50, ignoreErrno(xerrno) ? 3 : 1) ("ftpReadControlReply: read error: %s\n", xstrerr(xerrno));
185 if (ignoreErrno(xerrno)) {
188 FtpStateData *ftpState = (FtpStateData *)data;
189 debug(9, 3) ("ftpAcceptDataConnection\n");
191 ! if (flag == COMM_ERR_CLOSING) {
195 if (EBIT_TEST(ftpState->entry->flags, ENTRY_ABORTED)) {
196 comm_close(ftpState->ctrl.fd);
198 FtpStateData *ftpState = (FtpStateData *)data;
199 debug(9, 3) ("ftpAcceptDataConnection\n");
201 ! if (flag == COMM_ERR_CLOSING)
204 if (EBIT_TEST(ftpState->entry->flags, ENTRY_ABORTED)) {
205 comm_close(ftpState->ctrl.fd);