Project

General

Profile

Feature #13379 » 0002-raise-Net-OpenTimeout.patch

ahorek (Pavel Rosický), 03/29/2017 08:23 PM

View differences:

lib/net/imap.rb
1092 1092
      @open_timeout = options[:open_timeout] || 30
1093 1093
      @read_timeout = options[:read_timeout] || 60
1094 1094
      @parser = ResponseParser.new
1095
      @sock = Socket.tcp(@host, @port, :connect_timeout => @open_timeout)
1095
      @sock = tcp_socket(@host, @port)
1096 1096
      begin
1097 1097
        if options[:ssl]
1098 1098
          start_tls_session(options[:ssl])
......
1132 1132
      end
1133 1133
    end
1134 1134

  
1135
    def tcp_socket(host, port)
1136
      Socket.tcp(host, port, :connect_timeout => @open_timeout)
1137
    rescue Errno::ETIMEDOUT
1138
      raise Net::OpenTimeout, "Timeout to open TCP connection to " +
1139
        "#{host}:#{port} (exceeds #{@open_timeout} seconds)"
1140
    end
1141

  
1135 1142
    def receive_responses
1136 1143
      connection_closed = false
1137 1144
      until connection_closed
1138
-