diff options
| author | Dan Fandrich <dan@coneharvesters.com> | 2008-08-26 21:28:57 +0000 | 
|---|---|---|
| committer | Dan Fandrich <dan@coneharvesters.com> | 2008-08-26 21:28:57 +0000 | 
| commit | 4b01dfe369896a8a93a3c82228c755a03da731e9 (patch) | |
| tree | 613f4dc7df725a87e4a6b9d7247111cdbc4509f0 /lib/connect.c | |
| parent | fc09d10560fe3b43a652be5a278fa61f67fcfdd7 (diff) | |
Fixed out of memory problems that caused torture test failures in tests
1021 and 1067.
Diffstat (limited to 'lib/connect.c')
| -rw-r--r-- | lib/connect.c | 13 | 
1 files changed, 5 insertions, 8 deletions
| diff --git a/lib/connect.c b/lib/connect.c index 4018eb042..860111f56 100644 --- a/lib/connect.c +++ b/lib/connect.c @@ -552,7 +552,7 @@ CURLcode Curl_store_ip_addr(struct connectdata *conn)  }  /* Used within the multi interface. Try next IP address, return TRUE if no -   more address exists */ +   more address exists or error */  static bool trynextip(struct connectdata *conn,                        int sockindex,                        bool *connected) @@ -578,8 +578,7 @@ static bool trynextip(struct connectdata *conn,        conn->sock[sockindex] = sockfd;        conn->ip_addr = ai; -      Curl_store_ip_addr(conn); -      return FALSE; +      return Curl_store_ip_addr(conn) != CURLE_OK;      }      ai = ai->ai_next;    } @@ -919,6 +918,7 @@ CURLcode Curl_connecthost(struct connectdata *conn,  /* context */    long timeout_ms;    long timeout_per_addr; +  DEBUGASSERT(sockconn);    *connected = FALSE; /* default to not connected */    /* get the timeout left */ @@ -967,9 +967,10 @@ CURLcode Curl_connecthost(struct connectdata *conn,  /* context */      before = after;    }  /* end of connect-to-each-address loop */ +  *sockconn = sockfd;    /* the socket descriptor we've connected */ +    if(sockfd == CURL_SOCKET_BAD) {      /* no good connect was made */ -    *sockconn = CURL_SOCKET_BAD;      failf(data, "couldn't connect to host");      return CURLE_COULDNT_CONNECT;    } @@ -980,10 +981,6 @@ CURLcode Curl_connecthost(struct connectdata *conn,  /* context */    if(addr)      *addr = curr_addr; -  /* allow NULL-pointers to get passed in */ -  if(sockconn) -    *sockconn = sockfd;    /* the socket descriptor we've connected */ -    data->info.numconnects++; /* to track the number of connections made */    return CURLE_OK; | 
