I needed SSL with POE so I downloaded the sslpoe-package.
Great stuff but I found out that I needed this (in SslServer):
- my $resp = Net::SSLeay::accept($ssl);
+ eval {
+ local $SIG{ALRM} = sub { die "alarm\n" };
+ ualarm TIMEOUT;
+ my $resp = Net::SSLeay::accept($ssl);
+ ualarm 0;
+ if ($resp == -1) {
+ # handshake could not complete
+ die ("handshake failed");
+ }
+ };
+ if ($@) {
+ die unless $@ eq "alarm\n";
+ # timed out
+ die("SSL handshake timed out, maybe increase timeout in SslServer.pm");
+ }
I have not tested it very much but it shows my problem though..
If a non-ssl client connected and did not do anything everything just
hung.. Net::SSLeay::accept only returns if it got bad data or a
disconnect.. Mmmm single threaded apps..
I probably have to increase the timeout step by step since some
clients may be slow or the connection may be lagging.
Anyone have a better solution?
--
/Gabriel