lib/reel/server/https.rb in reel-0.6.0.pre5 vs lib/reel/server/https.rb in reel-0.6.0

- old
+ new

@@ -25,27 +25,40 @@ ssl_context.ca_path = options[:ca_path] ssl_context.extra_chain_cert = options[:extra_chain_cert] # if verify_mode isn't explicitly set, verify peers if we've # been provided CA information that would enable us to do so - ssl_context.verify_mode = if options.include?(:verify_mode) + ssl_context.verify_mode = case + when options.include?(:verify_mode) options[:verify_mode] - elsif options.include?(:ca_file) + when options.include?(:ca_file) OpenSSL::SSL::VERIFY_PEER - elsif options.include?(:ca_path) + when options.include?(:ca_path) OpenSSL::SSL::VERIFY_PEER else OpenSSL::SSL::VERIFY_NONE end @tcpserver = Celluloid::IO::TCPServer.new(host, port) server = Celluloid::IO::SSLServer.new(@tcpserver, ssl_context) options.merge!(host: host, port: port) - options[:rescue] = [ OpenSSL::SSL::SSLError ] - super(server, options, &callback) + end + + def run + loop do + begin + socket = @server.accept + rescue OpenSSL::SSL::SSLError, Errno::ECONNRESET, Errno::EPIPE, + Errno::ETIMEDOUT, Errno::EHOSTUNREACH => ex + Logger.warn "Error accepting SSLSocket: #{ex.class}: #{ex.to_s}" + retry + end + + async.handle_connection socket + end end end end end