Ethon::Multi::Operations

This module contains logic to run a multi.

Public Instance Methods

handle() click to toggle source

Return the multi handle. Inititialize multi handle, in case it didn’t happened already.

@example Return multi handle.

multi.handle

@return [ FFI::Pointer ] The multi handle.

# File lib/ethon/multi/operations.rb, line 15
def handle
  @handle ||= FFI::AutoPointer.new(Curl.multi_init, Curl.method(:multi_cleanup))
end
init_vars() click to toggle source

Initialize variables.

@example Initialize variables.

multi.init_vars

@return [ void ]

# File lib/ethon/multi/operations.rb, line 25
def init_vars
  @timeout = ::FFI::MemoryPointer.new(:long)
  @timeval = Curl::Timeval.new
  @fd_read = Curl::FDSet.new
  @fd_write = Curl::FDSet.new
  @fd_excep = Curl::FDSet.new
  @max_fd = ::FFI::MemoryPointer.new(:int)
end
perform() click to toggle source

Perform multi.

@return [ nil ]

@example Perform multi.

multi.perform
# File lib/ethon/multi/operations.rb, line 40
def perform
  Ethon.logger.debug(STARTED_MULTI)
  while ongoing?
    run
    timeout = get_timeout
    next if timeout == 0
    reset_fds
    set_fds(timeout)
  end
  Ethon.logger.debug(PERFORMED_MULTI)
  nil
end
prepare() click to toggle source

Prepare multi.

@return [ nil ]

@example Prepare multi.

multi.prepare

@deprecated It is no longer necessary to call prepare.

# File lib/ethon/multi/operations.rb, line 61
def prepare
  Ethon.logger.warn(
    "ETHON: It is no longer necessay to call "+
    "Multi#prepare. Its going to be removed "+
    "in future versions."
  )
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.