Module: Ethon::Multi::Operations
- Included in:
- Ethon::Multi
- Defined in:
- lib/ethon/multi/operations.rb
Overview
This module contains logic to run a multi.
Instance Method Summary collapse
-
#handle ⇒ FFI::Pointer
Return the multi handle.
-
#init_vars ⇒ void
Initialize variables.
-
#perform ⇒ nil
Perform multi.
-
#prepare ⇒ nil
deprecated
Deprecated.
It is no longer necessary to call prepare.
Instance Method Details
#handle ⇒ FFI::Pointer
Return the multi handle. Inititialize multi handle, in case it didn’t happened already.
14 15 16 |
# File 'lib/ethon/multi/operations.rb', line 14 def handle @handle ||= Curl.multi_init end |
#init_vars ⇒ void
This method returns an undefined value.
Initialize variables.
24 25 26 27 28 29 30 31 |
# File 'lib/ethon/multi/operations.rb', line 24 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 ⇒ nil
Perform multi.
41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/ethon/multi/operations.rb', line 41 def perform Ethon.logger.debug("ETHON: started MULTI") while ongoing? run timeout = get_timeout next if timeout == 0 reset_fds set_fds(timeout) end Ethon.logger.debug("ETHON: performed MULTI") nil end |