/*
- * $Id: ftp.cc,v 1.181 1997/12/31 17:52:04 wessels Exp $
+ * $Id: ftp.cc,v 1.182 1997/12/31 19:28:08 wessels Exp $
*
* DEBUG: section 9 File Transfer Protocol (FTP)
* AUTHOR: Harvest Derived
err->dnsserver_msg = xstrdup(dns_error_message);
err->request = requestLink(request);
errorAppendEntry(ftpState->entry, err);
- comm_close(fd);
+ comm_close(ftpState->ctrl.fd);
} else if (status != COMM_OK) {
err = errorCon(ERR_CONNECT_FAIL, HTTP_SERVICE_UNAVAILABLE);
err->xerrno = errno;
err->port = request->port;
err->request = requestLink(request);
errorAppendEntry(ftpState->entry, err);
- comm_close(fd);
+ comm_close(ftpState->ctrl.fd);
} else {
ftpState->state = BEGIN;
ftpState->ctrl.buf = get_free_4k_page();
}
if (entry->store_status == STORE_PENDING)
storeAbort(entry, 0);
- comm_close(fd);
+ comm_close(ftpState->ctrl.fd);
}
}
}
if (entry->store_status == STORE_PENDING)
storeAbort(entry, 0);
- comm_close(fd);
+ comm_close(ftpState->ctrl.fd);
}
return;
}
errorAppendEntry(entry, err);
}
}
- comm_close(fd);
+ comm_close(ftpState->ctrl.fd);
return;
}
len += ftpState->ctrl.offset;
ftpFail(ftpState);
return;
}
- comm_add_close_handler(fd, ftpStateFree, ftpState);
+ /*
+ * No comm_add_close_handler() here. If we have both ctrl and
+ * data FD's call ftpStateFree() upon close, then we have
+ * to delete the close handler which did NOT get called
+ * to prevent ftpStateFree() getting called twice.
+ * Instead we'll always call comm_close() on the ctrl FD.
+ */
ftpState->data.fd = fd;
snprintf(cbuf, 1024, "PASV\r\n");
ftpWriteCommand(cbuf, ftpState);
err->port = ftpState->data.port;
err->request = requestLink(request);
errorAppendEntry(ftpState->entry, err);
- comm_close(fd);
+ comm_close(ftpState->ctrl.fd);
return;
}
ftpRestOrList(ftpState);