cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: AllowServerConnect timeout quesion

From: giladbu <giladbu_at_hotmail.com>
Date: Tue, 3 Feb 2004 21:40:27 +0200

Great! I checked the following change, and worked fine for me. The change is in bold.

Thanks Gilad

static CURLcode AllowServerConnect(struct connectdata *conn)
{
  fd_set rdset;
  struct timeval dt;
  struct SessionHandle *data = conn->data;
  int sock = conn->sock[SECONDARYSOCKET];
  
  FD_ZERO(&rdset);

  FD_SET(sock, &rdset);

  /* we give the server 10 seconds to connect to us */
  dt.tv_sec = ( data->set.connecttimeout ? data->set.connecttimeout : 10);
  dt.tv_usec = 0;

On Fri, 30 Jan 2004, gilad wrote:

> Hi, I thought of using the existing parameter of CONNECTTIMEOUT as in
> data->set.connecttimeout, instead of the 10 seconds by default.. Is it ok ?
> I will have no problem to check it :)
>
> instead of
> dt.tv_sec = 10;
> then
> dt.tv_sec = data->set.connecttimeout;

That's not a bad idea. But remember that the data->set.connecttimeout is 0 if
not set. It would probably be better to:

  dt.tv_sec = 60; /* probably a more sensible and more defensive default */

  if(data->set.connecttimeout)
    dt.tv_sec = data->set.connecttimeout;

.. or similar. Don't you agree?

-- 
    Daniel Stenberg -- http://curl.haxx.se/ -- http://daniel.haxx.se/
   [[ Do not send mails to this email address. They won't reach me. ]]
-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
Received on 2004-02-04