Oops, forget the fact that several ftp connections can be active
at the same time, so add new con_state to avoid QUIT recursion Still should go to 2.2
This commit is contained in:
parent
b92fd90719
commit
9e05df0992
@ -14,7 +14,7 @@
|
||||
* Turned inside out. Now returns xfers as new file ids, not as a special
|
||||
* `state' of FTP_t
|
||||
*
|
||||
* $Id: ftpio.c,v 1.15 1996/10/10 08:34:27 jkh Exp $
|
||||
* $Id: ftpio.c,v 1.16 1996/11/14 05:05:26 ache Exp $
|
||||
*
|
||||
*/
|
||||
|
||||
@ -540,21 +540,17 @@ static int
|
||||
ftp_close(FTP_t ftp)
|
||||
{
|
||||
int i;
|
||||
static int recursive = 0;
|
||||
|
||||
if (!recursive && ftp->con_state == isopen) {
|
||||
if (ftp->con_state == isopen) {
|
||||
ftp->con_state = quit;
|
||||
/* Debug("ftp_pkg: in ftp_close(), sending QUIT"); */
|
||||
recursive = 1;
|
||||
i = cmd(ftp, "QUIT");
|
||||
close(ftp->fd_ctrl);
|
||||
ftp->fd_ctrl = -1;
|
||||
ftp->con_state = init;
|
||||
if (check_code(ftp, i, FTP_QUIT_HAPPY)) {
|
||||
recursive = 0;
|
||||
ftp->errno = i;
|
||||
return FAILURE;
|
||||
}
|
||||
recursive = 0;
|
||||
/* Debug("ftp_pkg: ftp_close() - proper shutdown"); */
|
||||
return SUCCESS;
|
||||
}
|
||||
@ -580,7 +576,7 @@ cmd(FTP_t ftp, const char *fmt, ...)
|
||||
(void)vsnprintf(p, sizeof p, fmt, ap);
|
||||
va_end(ap);
|
||||
|
||||
if (ftp->con_state != isopen)
|
||||
if (ftp->con_state == init)
|
||||
return botch("cmd", "open");
|
||||
|
||||
strcat(p, "\r\n");
|
||||
|
@ -21,12 +21,12 @@
|
||||
* Turned inside out. Now returns xfers as new file ids, not as a special
|
||||
* `state' of FTP_t
|
||||
*
|
||||
* $Id: ftpio.h,v 1.7 1996/08/21 01:12:11 jkh Exp $
|
||||
* $Id: ftpio.h,v 1.8 1996/09/19 17:28:34 peter Exp $
|
||||
*/
|
||||
|
||||
/* Internal housekeeping data structure for FTP sessions */
|
||||
typedef struct {
|
||||
enum { init, isopen } con_state;
|
||||
enum { init, isopen, quit } con_state;
|
||||
int fd_ctrl;
|
||||
int addrtype;
|
||||
char *host;
|
||||
|
Loading…
Reference in New Issue
Block a user