Sha256: f5e3de70ee6cfa36dcb0fadde91302631943bf39c65c481f44fdc08b03553574

Contents?: true

Size: 1.11 KB

Versions: 63

Compression:

Stored size: 1.11 KB

Contents

module KQueue
  class Watcher
    # The {Watcher} subclass for events
    # fired when a socket can be read from or written to
    # (which of these is determined by \{ReadWrite#type}).
    # Read events are watched via {Queue#watch_socket_for_read},
    # and write events are watched via {Queue#watch_socket_for_write}.
    #
    # Note that read and write events for non-socket streams
    # use the {ReadWrite} class.
    class SocketReadWrite < ReadWrite
      # The custom low-water mark for the amount of data necessary
      # to trigger an event,
      # or `nil` if none has been set.
      #
      # @return [Fixnum, nil]
      attr_reader :low_water

      # Creates a new socket Watcher.
      #
      # @private
      def initialize(queue, fd, type, low_water, callback)
        if fd.is_a?(IO)
          @io = fd
          fd = fd.fileno
        end

        @fd = fd
        @type = type

        if low_water
          fflags = [:lowat]
          data = low_water
        else
          fflags = []
          data = nil
        end

        super(queue, @fd, type, fflags, data, callback)
      end
    end
  end
end

Version data entries

63 entries across 55 versions & 8 rubygems

Version Path
rb-kqueue-0.2.8 lib/rb-kqueue/watcher/socket_read_write.rb
vagrant-unbundled-2.2.19.0 vendor/bundle/ruby/3.0.0/gems/rb-kqueue-0.2.7/lib/rb-kqueue/watcher/socket_read_write.rb
vagrant-unbundled-2.2.18.0 vendor/bundle/ruby/3.0.0/gems/rb-kqueue-0.2.7/lib/rb-kqueue/watcher/socket_read_write.rb
rb-kqueue-0.2.7 lib/rb-kqueue/watcher/socket_read_write.rb
vagrant-unbundled-2.2.16.0 vendor/bundle/ruby/3.0.0/gems/rb-kqueue-0.2.6/lib/rb-kqueue/watcher/socket_read_write.rb
vagrant-unbundled-2.2.16.0 vendor/bundle/ruby/2.7.0/gems/rb-kqueue-0.2.5/lib/rb-kqueue/watcher/socket_read_write.rb
rb-kqueue-0.2.6 lib/rb-kqueue/watcher/socket_read_write.rb
vagrant-unbundled-2.2.14.0 vendor/bundle/ruby/2.7.0/gems/rb-kqueue-0.2.5/lib/rb-kqueue/watcher/socket_read_write.rb
vagrant-unbundled-2.2.10.0 vendor/bundle/ruby/2.7.0/gems/rb-kqueue-0.2.5/lib/rb-kqueue/watcher/socket_read_write.rb
vagrant-unbundled-2.2.9.0 vendor/bundle/ruby/2.7.0/gems/rb-kqueue-0.2.5/lib/rb-kqueue/watcher/socket_read_write.rb
vagrant-unbundled-2.2.8.0 vendor/bundle/ruby/2.7.0/gems/rb-kqueue-0.2.5/lib/rb-kqueue/watcher/socket_read_write.rb
vagrant-unbundled-2.2.7.0 vendor/bundle/ruby/2.7.0/gems/rb-kqueue-0.2.5/lib/rb-kqueue/watcher/socket_read_write.rb
vagrant-unbundled-2.2.7.0 vendor/bundle/ruby/2.6.0/gems/rb-kqueue-0.2.5/lib/rb-kqueue/watcher/socket_read_write.rb
vagrant-unbundled-2.2.7.0 vendor/bundle/ruby/2.4.0/gems/rb-kqueue-0.2.5/lib/rb-kqueue/watcher/socket_read_write.rb
vagrant-unbundled-2.2.6.2 vendor/bundle/ruby/2.6.0/gems/rb-kqueue-0.2.5/lib/rb-kqueue/watcher/socket_read_write.rb
vagrant-unbundled-2.2.6.1 vendor/bundle/ruby/2.6.0/gems/rb-kqueue-0.2.5/lib/rb-kqueue/watcher/socket_read_write.rb
vagrant-unbundled-2.2.6.0 vendor/bundle/ruby/2.6.0/gems/rb-kqueue-0.2.5/lib/rb-kqueue/watcher/socket_read_write.rb
vagrant-unbundled-2.2.5.0 vendor/bundle/ruby/2.5.0/gems/rb-kqueue-0.2.5/lib/rb-kqueue/watcher/socket_read_write.rb
vagrant-unbundled-2.2.5.0 vendor/bundle/ruby/2.6.0/gems/rb-kqueue-0.2.5/lib/rb-kqueue/watcher/socket_read_write.rb
vagrant-unbundled-2.2.4.0 vendor/bundle/ruby/2.5.0/gems/rb-kqueue-0.2.5/lib/rb-kqueue/watcher/socket_read_write.rb