[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Bug-wget] gnutls_handshake can return GNUTLS_E_INTERRUPTED
From: |
Tim Ruehsen |
Subject: |
Re: [Bug-wget] gnutls_handshake can return GNUTLS_E_INTERRUPTED |
Date: |
Fri, 01 Jul 2016 09:38:56 +0200 |
User-agent: |
KMail/4.14.10 (Linux/4.6.0-1-amd64; KDE/4.14.21; x86_64; ; ) |
On Thursday 30 June 2016 17:18:36 Daniel Stenberg wrote:
> On Thu, 30 Jun 2016, Tim Ruehsen wrote:
> > I believe, we already handle that case. If GNUTLS_E_INTERRUPTED occurs, we
> > restart the loop and re-enter gnutls_handshake(). This happens for all
> > non-fatal errors.
>
> Right, but then it won't wait for the socket and just busy-loop. The
> gnutls_record_get_direction man page[*] seems to suggest that waiting for
> the socket is the appropriate way:
>
> This function provides information about the internals of the record
> protocol and is only useful if a prior gnutls function call (e.g.
> gnutls_handshake()) was interrupted for some reason, that is, if a function
> returned GNUTLS_E_INTERRUPTED or GNUTLS_E_AGAIN. In such a case, you might
> want to call select() or poll() before calling the interrupted gnutls
> function again
>
> [*] = http://linux.die.net/man/3/gnutls_record_get_direction
GNUTLS_E_INTERRUPTED is returned if the process got a signal that interrupts
blocking I/O (for wget this is SIGUSR1 and SIGHUP). If it is just *one* signal
(very likely), a successive call to gnutls_handshake() would not return again
with this value.
If the process gets 'hammered' by signals, we have a busy-loop. But with your
change, the poll/wait would also immediate return with errno=EINTR - and we
have a busy-loop as well.
So from what I can judge, your change adds 'complexity' without any gain.
Tim
signature.asc
Description: This is a digitally signed message part.
- Re: [Bug-wget] gnutls_handshake can return GNUTLS_E_INTERRUPTED,
Tim Ruehsen <=