Sha256: a754f35ba1e0828f72693d15ff146fa5fae18931ead8823185722b10387db998

Contents?: true

Size: 1.16 KB

Versions: 38

Compression:

Stored size: 1.16 KB

Contents

# frozen_string_literal: true
module Excon
  class UnixSocket < Excon::Socket

    private

    def connect
      @socket  = ::Socket.new(::Socket::AF_UNIX, ::Socket::SOCK_STREAM, 0)
      # If a Unix proxy was specified, the :path option will be set for it,
      # otherwise fall back to the :socket option.
      proxy_path = @data[:proxy] ? @data[:proxy][:path] : nil
      sockaddr = ::Socket.sockaddr_un(proxy_path || @data[:socket])
      if @nonblock
        begin
          @socket.connect_nonblock(sockaddr)
        rescue Errno::EINPROGRESS
          unless IO.select(nil, [@socket], nil, @data[:connect_timeout])
            raise(Excon::Errors::Timeout.new("connect timeout reached"))
          end
          begin
            @socket.connect_nonblock(sockaddr)
          rescue Errno::EISCONN
          end
        end
      else
        begin
          Timeout.timeout(@data[:connect_timeout]) do
            @socket.connect(sockaddr)
          end
        rescue Timeout::Error
          raise Excon::Errors::Timeout.new('connect timeout reached')
        end
      end

    rescue => error
      @socket.close rescue nil if @socket
      raise error
    end

  end
end

Version data entries

38 entries across 36 versions & 4 rubygems

Version Path
coingecko_client-0.1.2 vendor/bundle/ruby/2.7.0/gems/excon-0.75.0/lib/excon/unix_socket.rb
vagrant-unbundled-2.2.16.0 vendor/bundle/ruby/2.7.0/gems/excon-0.78.1/lib/excon/unix_socket.rb
vagrant-unbundled-2.2.14.0 vendor/bundle/ruby/2.7.0/gems/excon-0.78.1/lib/excon/unix_socket.rb
excon-0.78.1 lib/excon/unix_socket.rb
excon-0.78.0 lib/excon/unix_socket.rb
excon-0.76.0 lib/excon/unix_socket.rb
coingecko_client-0.1.1 vendor/bundle/ruby/2.7.0/gems/excon-0.75.0/lib/excon/unix_socket.rb
coingecko_client-0.1.0 vendor/bundle/ruby/2.7.0/gems/excon-0.75.0/lib/excon/unix_socket.rb
excon-0.75.0 lib/excon/unix_socket.rb
excon-0.74.0 lib/excon/unix_socket.rb
excon-0.73.0 lib/excon/unix_socket.rb
excon-0.72.0 lib/excon/unix_socket.rb
excon-0.71.1 lib/excon/unix_socket.rb
excon-0.71.0 lib/excon/unix_socket.rb
excon-0.70.0 lib/excon/unix_socket.rb
excon-0.69.1 lib/excon/unix_socket.rb
excon-0.69.0 lib/excon/unix_socket.rb
excon-0.68.0 lib/excon/unix_socket.rb
excon-0.67.0 lib/excon/unix_socket.rb
excon-0.66.0 lib/excon/unix_socket.rb