-
-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Thread safety #31
Comments
According to OpenSSL documentation, we need to set locking functions to use it from multiple threads and currently this is not done. I'm not sure how is it going to be possible to define C callbacks working with mutexes from Perl6 code... FWIW #34 contains another example showing that using this module from multiple threads currently doesn't work. |
FYI IO::Socket::INET is only thread safe if you read a socket in the thread it was created |
It's a pity that going from IO::Socket::Async to something like IO::Socket::Async:SSL seems so hard. And yes, I was already aware of the limitation that each socket can only be used in one thread. Thank you for the info though! |
You can write a naive SSL Async wrapper in ~50 LoC https://gist.github.com/ugexe/71d82eb4bb5653125bd8 |
That's great, this should be a module! |
I'm not sure if it's thread safe. All the data is fetched with IO::Socket::Async so that data should be able to cross threads unlike INET. But I'm not sure how/if that changes what happens with OpenSSL accessing that data - it was too slow for what I needed so I didn't test it further |
There is now an IO::Socket::Async::SSL, which can work across multiple threads (tests for that included in its test suite). |
Awesome!! Thank you jnthn! |
The following code fails for me and gives the cryptic error message "Cannot unbox a type object":
Note that there is no error if the lines containing
$p2
are removed.The basic Socket:INET seems already to be thread safe.
Is there hope for thread safe SSL-sockets?
The text was updated successfully, but these errors were encountered: