[tolj@wapme-systems.de: Re: Problem with accept?!! (was: Re: apache cygwin package hangs when MaxRequestsPerChild reached!)]

Thomas Pfaff tpfaff@gmx.net
Tue Jun 3 09:44:00 GMT 2003


Corinna Vinschen wrote:
> On Mon, Jun 02, 2003 at 01:18:25PM +0200, Corinna Vinschen wrote:
> 
>>    Duplicated sockets all share the same event handler.
>>[...]
>>As a starting point I'm now throwing some fuel in here:  What about
>>running accept and connect in another thread which can be terminated
>>using TerminateThread if a signal arrives?
> 
> I've applied a patch which implements blocking accept and connect now
> using threads.  All my tests worked (ssh, ftp, telnet rlogin, rsh,
> fake server and client to test interrupting the blocking calls) but
> nevertheless I'd appreciate if somebody takes a heart and gives that
> stuff also a thorough testing.

Corinna,

i took a heart and did some testing.

1. You must pass the winsock error between the threads.
2. I changed the connect stuff to nonblocking and use select to wait. 
This should make sure that the connect will be continued in background 
if an interrupt comes in just like the opengroup specifies.
3. accept will use select to wait for incoming connections, the accept 
call itself will be made in the waiting thread. This should make sure 
that accept is not interrupted and avoid a loss of an already connected 
socket when TerminateThread stops the thread when it is already returning.

Attached are my changes so far, i will do some further testing.

Thomas


-------------- next part --------------
A non-text attachment was scrubbed...
Name: fhandler_socket.patch
Type: plain/text
Size: 3833 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin-developers/attachments/20030603/ea442ef0/attachment.bin>


More information about the Cygwin-developers mailing list