Module: Ethon::Multi::Operations
- Included in:
- Ethon::Multi
- Defined in:
- lib/ethon/multi/operations.rb
Overview
This module contains logic to run a multi.
Constant Summary collapse
- STARTED_MULTI =
"ETHON: started MULTI"
- PERFORMED_MULTI =
"ETHON: performed 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.
15 16 17 |
# File 'lib/ethon/multi/operations.rb', line 15 def handle @handle ||= FFI::AutoPointer.new(Curl.multi_init, Curl.method(:multi_cleanup)) end |
#init_vars ⇒ void
This method returns an undefined value.
Initialize variables.
25 26 27 28 29 30 31 32 |
# 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 ⇒ nil
Perform multi.
40 41 42 43 44 45 46 47 48 49 50 51 |
# 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 |