lib/cztop/patterns/lazy_pirate.rb
# (Re-) Initializes the socket and connects to the next endpoint (cycling
# through them).
(Re-) Initializes the socket and connects to the next endpoint (cycling
through them).
( Re - ) Initializes the socket and connects to the next endpoint ( cycling through them ) .
def reinit_sock
    if @socket
      @poller.remove_reader(@socket)
      @socket.close
      sleep @settle_delay / 1000.0
    end
    @socket = CZTop::Socket::REQ.new
    @socket.options.linger = 0
    endpoint = @endpoints.next
    puts "trying to connect to endpoint #{endpoint.inspect}"
    @socket.connect(endpoint)
    @poller.add_reader(@socket)
  end
def reinit_sock if @socket @poller . remove_reader ( @socket ) @socket . close sleep @settle_delay / 1000.0 end @socket = CZTop :: Socket :: REQ . new @socket . options . linger = 0 endpoint = @endpoints . next puts "trying to connect to endpoint #{endpoint.inspect}" @socket . connect ( endpoint ) @poller . add_reader ( @socket ) end
(Re-) Initializes the socket and connects to the next endpoint (cycling
through them).
( Re - ) Initializes the socket and connects to the next endpoint ( cycling through them ) .