lib/net/pop.rb in net-pop-0.1.1 vs lib/net/pop.rb in net-pop-0.1.2

- old
+ new

@@ -193,11 +193,11 @@ # The POPMail#unique_id() method returns the unique-id of the message as a # String. Normally the unique-id is a hash of the message. # class POP3 < Protocol # version of this library - VERSION = "0.1.1" + VERSION = "0.1.2" # # Class Parameters # @@ -538,11 +538,14 @@ end end # internal method for Net::POP3.start def do_start(account, password) # :nodoc: - s = Timeout.timeout(@open_timeout, Net::OpenTimeout) do - TCPSocket.open(@address, port) + 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)