lib/async/io/ssl_socket.rb in async-io-1.42.1 vs lib/async/io/ssl_socket.rb in async-io-1.43.0
- old
+ new
@@ -49,13 +49,17 @@
def initialize(socket, context)
if socket.is_a?(self.class.wrapped_klass)
super
else
io = self.class.wrapped_klass.new(socket.to_io, context)
- super(io, socket.reactor)
-
- # We detach the socket from the reactor, otherwise it's possible to add the file descriptor to the selector twice, which is bad.
- socket.reactor = nil
+ if socket.respond_to?(:reactor)
+ super(io, socket.reactor)
+
+ # We detach the socket from the reactor, otherwise it's possible to add the file descriptor to the selector twice, which is bad.
+ socket.reactor = nil
+ else
+ super(io)
+ end
# This ensures that when the internal IO is closed, it also closes the internal socket:
io.sync_close = true
@timeout = socket.timeout