bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v2] implement full-blown select(2) for winsock


From: Simon Josefsson
Subject: Re: [PATCH v2] implement full-blown select(2) for winsock
Date: Tue, 23 Sep 2008 18:18:02 +0200
User-agent: Gnus/5.110011 (No Gnus v0.11) Emacs/22.2 (gnu/linux)

Paolo Bonzini <address@hidden> writes:

> Simon Josefsson wrote:
>> Paolo Bonzini <address@hidden> writes:
>> 
>>> This revised patch includes the select(2) wrapper in sys_select,
>>> not sys_socket.  This makes sense given the very purpose of the
>>> wrapper -- which is to let the client use select for other descriptor
>>> types than socket handles.
>> 
>> Btw, if you didn't like your code here, what do you think of the code
>> I've been using in GnuTLS so far?  See:
>> 
>> http://git.savannah.gnu.org/gitweb/?p=gnutls.git;a=blob;f=src/select.c;hb=HEAD
>
> The main difference is that your code assumes file descriptors and
> socket handles do not overlap; mine instead assumes that winsock.c is in
> use (and hence that there are no separate socket handles).
>
> Your code is much less ugly, and has a couple of optimizations in the
> case all the file descriptors are sockets.  The downside of your
> implementation is that it does not handle console handles (e.g. stdin)
> and does not detect writeability of pipes.  Also, it has an
> almost-busy-waiting loop that my code does not have.  In particular,
> while your code alternates checking pipes and sockets every 0.1 sec.,
> mine polls at the beginning and asks Winsock to set an event when a
> socket becomes ready (because you can wait on pipes and events, but not
> on pipes and sockets).

Thanks for comparison.

The code does handle console handles though, gnutls-cli uses select to
wait for data from network sockets and from stdin, and I believe it
works under Windows.

Still, I don't see any reason to keep using this hack in gnutls, so I'm
going to test your code.  The timing is a bit bad since we expect to
release 1.6.0 on oct 1th, but this affects command line tools only and
only on Windows which is an experimental platform for us anyway, so
maybe it can make it.

>> Personally I'd be happy to replace the hack I've been using with your
>> implementation, but if there is anything to keep in mind before doing
>> that, it would be useful to know.
>
> No, except that any hack to use closesocket/WSAGetLastError instead of
> close/errno *must* be removed.  As soon as my thing goes in, you should
> be able to replace your select.c and the aforementioned hacks with the
> gnulib modules errno, sys_socket and sys_select.

Great,
Simon




reply via email to

[Prev in Thread] Current Thread [Next in Thread]