aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2011-12-20 13:06:26 +0100
committerDaniel Stenberg <daniel@haxx.se>2011-12-20 20:30:38 +0100
commit377471f387c6639882fd8bd66a9e7b8e8341843d (patch)
treef7aec57b02a0e21e2954e7852d2a8d867787be20
parentdfdac61522c7d660f884ec7a663dedb2d69d16a8 (diff)
FTP: move FTP-specific struct field to ftpc_conn
"wait_data_conn" was added to the connectionbits in commit c834213ad5 for handling active FTP connections but as it is purely FTP specific and now only ever accessed by ftp.c I moved it into the FTP connection struct.
-rw-r--r--lib/ftp.c17
-rw-r--r--lib/ftp.h1
-rw-r--r--lib/urldata.h3
3 files changed, 11 insertions, 10 deletions
diff --git a/lib/ftp.c b/lib/ftp.c
index 2c5a98216..a4512e900 100644
--- a/lib/ftp.c
+++ b/lib/ftp.c
@@ -844,7 +844,7 @@ static int ftp_domore_getsock(struct connectdata *conn, curl_socket_t *socks,
}
socks[0] = conn->sock[SECONDARYSOCKET];
- if(conn->bits.wait_data_conn) {
+ if(ftpc->wait_data_conn) {
socks[1] = conn->sock[FIRSTSOCKET];
return GETSOCK_READSOCK(0) | GETSOCK_READSOCK(1);
}
@@ -2355,11 +2355,12 @@ static CURLcode ftp_state_stor_resp(struct connectdata *conn,
return result;
if(!connected) {
+ struct ftp_conn *ftpc = &conn->proto.ftpc;
infof(data, "Data conn was not available immediately\n");
/* as there's not necessarily an immediate action on the control
connection now, we halt the state machine */
state(conn, FTP_STOP);
- conn->bits.wait_data_conn = TRUE;
+ ftpc->wait_data_conn = TRUE;
}
return CURLE_OK;
@@ -2468,9 +2469,10 @@ static CURLcode ftp_state_get_resp(struct connectdata *conn,
return result;
if(!connected) {
+ struct ftp_conn *ftpc = &conn->proto.ftpc;
infof(data, "Data conn was not available immediately\n");
state(conn, FTP_STOP);
- conn->bits.wait_data_conn = TRUE;
+ ftpc->wait_data_conn = TRUE;
}
}
else
@@ -3649,7 +3651,7 @@ static CURLcode ftp_do_more(struct connectdata *conn, bool *complete)
/* a transfer is about to take place, or if not a file name was given
so we'll do a SIZE on it later and then we need the right TYPE first */
- if(conn->bits.wait_data_conn == TRUE) {
+ if(ftpc->wait_data_conn == TRUE) {
bool serv_conned;
result = ReceivedServerConnect(conn, &serv_conned);
@@ -3659,7 +3661,7 @@ static CURLcode ftp_do_more(struct connectdata *conn, bool *complete)
if(serv_conned) {
/* It looks data connection is established */
result = AcceptServerConnect(conn);
- conn->bits.wait_data_conn = FALSE;
+ ftpc->wait_data_conn = FALSE;
if(result == CURLE_OK)
result = InitiateTransfer(conn);
}
@@ -3705,7 +3707,7 @@ static CURLcode ftp_do_more(struct connectdata *conn, bool *complete)
too! */
Curl_setup_transfer(conn, -1, -1, FALSE, NULL, -1, NULL);
- if(!conn->bits.wait_data_conn) {
+ if(!ftpc->wait_data_conn) {
/* no waiting for the data connection so this is now complete */
*complete = TRUE;
DEBUGF(infof(data, "DO-MORE phase ends with %d\n", (int)result));
@@ -3989,9 +3991,10 @@ static CURLcode wc_statemach(struct connectdata *conn)
static CURLcode ftp_do(struct connectdata *conn, bool *done)
{
CURLcode retcode = CURLE_OK;
+ struct ftp_conn *ftpc = &conn->proto.ftpc;
*done = FALSE; /* default to false */
- conn->bits.wait_data_conn = FALSE; /* default to no such wait */
+ ftpc->wait_data_conn = FALSE; /* default to no such wait */
/*
Since connections can be re-used between SessionHandles, this might be a
diff --git a/lib/ftp.h b/lib/ftp.h
index 4c1296fef..21e47374b 100644
--- a/lib/ftp.h
+++ b/lib/ftp.h
@@ -139,6 +139,7 @@ struct ftp_conn {
already has been done */
bool cwdfail; /* set TRUE if a CWD command fails, as then we must prevent
caching the current directory */
+ bool wait_data_conn; /* this is set TRUE if data connection is waited */
char *prevpath; /* conn->path from the previous transfer */
char transfertype; /* set by ftp_transfertype for use by Curl_client_write()a
and others (A/I or zero) */
diff --git a/lib/urldata.h b/lib/urldata.h
index 822412d05..be7b1e320 100644
--- a/lib/urldata.h
+++ b/lib/urldata.h
@@ -411,9 +411,6 @@ struct ConnectBits {
bool do_more; /* this is set TRUE if the ->curl_do_more() function is
supposed to be called, after ->curl_do() */
-
- bool wait_data_conn; /* this is set TRUE if data connection is waited */
-
bool tcpconnect[2]; /* the TCP layer (or similar) is connected, this is set
the first time on the first connect function call */
bool protoconnstart;/* the protocol layer has STARTED its operation after