This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Inetutils 1.3.2: Problem running ftpd server under windows 4.0


On Sun, Jun 10, 2001 at 05:28:47PM -0700, Jonathan Marcus wrote:
> I have found what appears to be a bug in the ftpd server from the
> inetutils 1.3.2.  I am using the server to download an embedded
> processor.  The embedded client FTPs 2 files in quick succession
> requesting the same TCP PORT for both.  When the server attempts the
> second download, it gets an EADDRINUSE error from Windows.  It retries
> the connect for 90 seconds before returning an error to the FTP client.
> 
> I don't know if the error is because the first iteration of the FTP
> server didn't properly close the socket or if Windows NT is slow to
> clean up the resource.  In either event, I believe that the correct
> behavior would be to return the error to the client without retrying.
> The code looks like this:
> 
>         while (connect(data, (struct sockaddr *)&data_dest,
>             sizeof(data_dest)) < 0) {
>                 if (errno == EADDRINUSE && retry < swaitmax) {
>                         sleep((unsigned) swaitint);
>                         retry += swaitint;
>                         continue;
>                 }
>                 perror_reply(425, "Can't build data connection");
>                 (void) fclose(file);
>                 data = -1;
>                 return (NULL);
>         }
> [...]
>                 case 'r':
>                         /* Maximum time to spend retrying */
>                         /* an EADDRINUSE error.            */
>                         swaitmax = atoi(optarg);
>                         break;
> 
> This would allow the server to default to the existing behavior, but let
> the user specify the maximum time to spend retrying an EADDRINUSE error.
> In my case, I would use the flag -r 0 to indicate that EADDRINUSE errors
> would never be retried.

Wouldn't it be better to find the reason first? ftpd sets SO_REUSEADDR
on the socket so it's somewhat interesting to get an EADDRINUSE error.
Are you sure there's not a problem in the client, perhaps?
Or could you perhaps test if we should add a SO_LINGER option
with a minimal linger timeout?

Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Developer                                mailto:cygwin@cygwin.com
Red Hat, Inc.

--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]