This is the mail archive of the cygwin-developers@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]
Other format: [Raw text]

Re: [tolj@wapme-systems.de: Re: Problem with accept?!!


Corinna Vinschen wrote:

Thomas,

On Tue, Jun 03, 2003 at 02:01:15PM +0200, Corinna Vinschen wrote:

FYI, I've just switch accept() to use cygwin_select instead of its own
thread.  Works like a charm.  fhandler_socket::accept looks like this:
[...]


I have a complete new implementation now, using cygwin_select.  It seems
to work really nicely.  However, would you mind to have a look into this
before I check it in?  Again, all my tests are working fine, this time
even the message when trying to connect an already connected socket makes
sense :-)

I've attached the patch related to current CVS.  Note that I've moved
the cygwin_select stuff into cygwin_connect and cygwin_accept in net.cc
since there's the natural point at which the file descriptor is still
accessible (instead of propagating the descriptor to the fhandler_socket
method).


I have tried this one and it looks really good. The only thing i would change is that i would check except_fds instead of write_fds.


Thomas


--- net.cc.org 2003-06-03 15:22:49.000000000 +0200 +++ net.cc 2003-06-03 15:24:06.000000000 +0200 @@ -794,9 +794,7 @@ cygwin_connect (int fd, const struct soc FD_SET (fd, write_fds); FD_SET (fd, except_fds); res = cygwin_select (fd + 1, NULL, write_fds, except_fds, NULL); - if (res > 0 && FD_ISSET (fd, write_fds)) - res = 0; - else if (res > 0) + if (res > 0 && FD_ISSET (fd, except_fds)) { res = -1; for (;;) @@ -813,6 +811,8 @@ cygwin_connect (int fd, const struct soc low_priority_sleep (0); } } + else if (res > 0) + res = 0; else { WSASetLastError (WSAEINPROGRESS);



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