]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
FTP: move FTP-specific struct field to ftpc_conn
authorDaniel Stenberg <daniel@haxx.se>
Tue, 20 Dec 2011 12:06:26 +0000 (13:06 +0100)
committerDaniel Stenberg <daniel@haxx.se>
Tue, 20 Dec 2011 19:30:38 +0000 (20:30 +0100)
"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.

lib/ftp.c
lib/ftp.h
lib/urldata.h

index 2c5a982163c9c7e19619e566cd2ad7293d5f57e8..a4512e900dbe8bce0ad0fb3e950073386fd09d32 100644 (file)
--- 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
index 4c1296fef0f4d66ded2a7b3cf9d71c5b142cda6c..21e47374b66b64e35601370fc5b23eef94356aa3 100644 (file)
--- 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) */
index 822412d05852a4ee55fa0c2993d7c8df58c7489b..be7b1e3205a486e11d7fcd95c701c9201baac414 100644 (file)
@@ -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