morgon has asked for the wisdom of the Perl Monks concerning the following question:
I need to pass an IO::Socket::SSL instance from one thread to another to fix a poorly designed script that I don't have the time to rewrite.
Directly sharing it is not possible (you get an error that it is not sharable) so at the moment I am trying to share the underlying file-descriptor but I am having problems re-creating an IO::Socket::SSL instance in the other thread.
I have tried this:
but that only gives me an IO::Handle-instance and I don't understand the second argument of new_from_fd at all (I had assumed that if I needed to use a mode of "rw" but that raises an error or "invalid mode").my $socket_fd :shared; # in one thread $socket_fd = $ssl_socket->fileno; # in another thread my $ssl_socket = IO::Handler->new_from_fd($socket_fd, "r");
To get an instance of the proper class I have tried
but that only gets me an undef.my $ssl_socket = IO::Socket::SLL->new_from_fd($socket_fd, "r");
So evidently I don't have a clue on how to do this if it is possible at all - can someone please help me here?
Many thanks!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Passing SSL-socket among threads
by wrog (Friar) on Mar 19, 2012 at 20:26 UTC |