Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re^8: IO::Socket::SSL sometimes says 'SSL wants a read first'

by noxxi (Pilgrim)
on Apr 21, 2017 at 09:01 UTC ( [id://1188528]=note: print w/replies, xml ) Need Help??


in reply to Re^7: IO::Socket::SSL sometimes says 'SSL wants a read first'
in thread IO::Socket::SSL sometimes says 'SSL wants a read first'

You have some point that easy things should be easy. But, different users have a different understanding of what is easy and how they expect programs to behave. IO::Socket::SSL is not specifically designed to make it harder. Regarding EINTR it just behaves like all the other IO::Socket modules and it would in my opinion against the expectations if it would behave differently. Just try the following code and you'll see that IO::Socket::INET behaves the same regarding EINTR, i.e. breaks the connect if SIGCHLD is triggered before the connect is done:

$SIG{CHLD} = sub { warn "child returned" }; if (!fork()) { sleep(1); exit(0); } # parent: fails with EINTR if child returns before connect succeeds my $cl = IO::Socket::INET->new('some_host:dropped_port') or die $!;

Replies are listed 'Best First'.
Re^9: IO::Socket::SSL sometimes says 'SSL wants a read first'
by salva (Canon) on Apr 21, 2017 at 09:34 UTC
    you'll see that IO::Socket::INET behaves the same regarding EINTR

    Right, but those are two completely different beasts: IO::Socket::INET is just a thin wrapper around the networking support provided by the kernel. On the other hand, IO::Socket::SSL implements a full and complex protocol on top of that. It even allows you to pass callbacks for customizing the connect behavior. Restarting a TCP socket is cheap and doesn't have visible consecuences for the user while restarting a TLS connection may require some repeated interaction with the user, as for instance, accepting certificates.

    Besides that, signals showing up while inside IO::Socket::SSL will turn into EINTR errors only when they catch the module inside a blocking syscall which, as TLS has a significant computational cost, may be quite less often than in the IO::Socket::INET case. So, depending on EINTR may be quite unreliable anyway and so useless.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1188528]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (6)
As of 2024-04-18 15:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found