Changeset 794

Show
Ignore:
Timestamp:
09/29/08 18:28:44 (5 days ago)
Author:
raggi
Message:

Added start_tls argument checks from brianmario

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/docs/ChangeLog

    r793 r794  
    180180 - Fixes in EM.defer under start/stop conditions. Reduced scope of threads. 
    18118123Sep08: Added patch from tmm1 to avoid popen errors on exit. 
     18230Sep08: Added File.exists? checks in the args for start_tls, as suggested by 
     183  Brian Lopez (brianmario). 
  • trunk/lib/eventmachine.rb

    r788 r794  
    173173#  
    174174module EventMachine 
     175  class FileNotFoundException < Exception; end 
     176   
    175177  class << self 
    176178    attr_reader :threadpool 
     
    15531555        # 
    15541556        def start_tls args={} 
    1555                 EventMachine::set_tls_parms( 
    1556                         @signature, 
    1557                         args[:private_key_file] || "", 
    1558                         args[:cert_chain_file] || "" 
    1559                 ) 
     1557          priv_key, cert_chain = args.values_at(:private_key_file, :cert_chain_file) 
     1558           
     1559          [priv_key, cert_chain].each do |file| 
     1560            next if file.nil? or file.empty? 
     1561            raise FileNotFoundException,  
     1562              "Could not find #{file} for start_tls" unless File.exists? file 
     1563    end 
     1564                 
     1565                EventMachine::set_tls_parms(@signature, priv_key || '', cert_chain || '') 
     1566                 
    15601567                EventMachine::start_tls @signature 
    15611568        end