class Net::POP3
def do_start(account, password) # :nodoc:
internal method for Net::POP3.start
def do_start(account, password) # :nodoc: begin s = Socket.tcp @address, port, nil, nil, connect_timeout: @open_timeout rescue Errno::ETIMEDOUT #raise Net:OpenTimeout instead for compatibility with previous versions raise Net::OpenTimeout, "Timeout to open TCP connection to "\ "#{@address}:#{port} (exceeds #{@open_timeout} seconds)" end if use_ssl? raise 'openssl library not installed' unless defined?(OpenSSL) context = OpenSSL::SSL::SSLContext.new context.set_params(@ssl_params) s = OpenSSL::SSL::SSLSocket.new(s, context) s.hostname = @address s.sync_close = true ssl_socket_connect(s, @open_timeout) if context.verify_mode != OpenSSL::SSL::VERIFY_NONE s.post_connection_check(@address) end end @socket = InternetMessageIO.new(s, read_timeout: @read_timeout, debug_output: @debug_output) logging "POP session started: #{@address}:#{@port} (#{@apop ? 'APOP' : 'POP'})" on_connect @command = POP3Command.new(@socket) if apop? @command.apop account, password else @command.auth account, password end @started = true ensure # Authentication failed, clean up connection. unless @started s.close if s @socket = nil @command = nil end end