Am 08.09.2009 um 18:31 schrieb Robin Seggelmann via RT:

>
> Am 08.09.2009 um 18:15 schrieb Stephen Henson via RT:
>
>>> [seggelm...@fh-muenster.de - Thu Sep 03 18:09:34 2009]:
>>>
>>> This patch adds the function dtls1_listen(SSL *s, struct sockaddr
>>> *client), as well as the user accessible macro DTLSv1_listen(). It  
>>> is
>>> intended to be called with an SSL object with a listening socket.
>>>
>> [snip to example]
>>
>>>             
>>>     /* Wait for ClientHello with valid cookie (blocking) */
>>>     while (!DTLSv1_listen(ssl, &client_addr));
>>>
>>
>> Is the above just an example or would it always block, possibly
>> indefinitely? If so is there some way this could work with non-
>> blocking I/O?
>
> That's just a simple example. If you use blocking sockets, it doesn't
> return until a ClientHello with a valid cookie has been received
> (returns 1) or an error occurred (returns 0). If you use non-blocking
> sockets, it always returns 0 on EAGAIN, so you can use select() to
> only call it when there's data to process and it will return as soon
> as there is nothing left.

I forgot to mention that in the example above I have socket timeouts  
set. That's the reason why the listen call is in a loop to try again  
as soon as it returned because of EAGAIN.

- Robin


______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       openssl-dev@openssl.org
Automated List Manager                           majord...@openssl.org

Reply via email to