socketry / nio4r

Cross-platform asynchronous I/O primitives for scalable network clients and servers.
Other
965 stars 86 forks source link

Errors if OpenSSL isn't loaded... #238

Closed MSP-Greg closed 4 years ago

MSP-Greg commented 4 years ago

Monitor and Selector both test whether an io is an OpenSSL::SSL::SSLSocket, but OpenSSL may not be loaded.

Both statements are:

unless io.is_a? OpenSSL::SSL::SSLSocket

Maybe change to:

unless defined?(::OpenSSL) && io.is_a?(OpenSSL::SSL::SSLSocket)

This was my error, as I assumed OpenSSL was loaded. Noticed when testing changes to Puma where OpenSSL is only loaded if ssl sockets are used/bound to...

EDIT: Puma is often used with only UNIXSockets.

ioquatix commented 4 years ago

Do you want to make a PR?

MSP-Greg commented 4 years ago

Do you want to make a PR?

See https://github.com/socketry/nio4r/pull/239. Again, sorry for this. I think many apps may load OpenSSL for database connections, etc, but it certainly is a valid use case. I've never checked to see if bundle exec loads OpenSSL...