Sha256: 1a0f0f9630fd17953a56b1c74c170447e1d8db7b3b40c581a8e6f417c5f09b5a

Contents?: true

Size: 663 Bytes

Versions: 1

Compression:

Stored size: 663 Bytes

Contents

require 'litmus_paper/agent_check_server'

module LitmusPaper
  class MultiPortAgentServer
    include AgentCheckServer

    attr_reader :services

    def initialize(litmus_paper_config, daemonize, pid_file, services, workers)
      super(litmus_paper_config, daemonize, pid_file, workers)
      @services = services
      @control_sockets = @services.keys.map do |port|
        TCPServer.new(port)
      end
    end

    def service_for_socket(socket)
      _, remote_port, _, remote_ip = socket.peeraddr(:numeric)
      LitmusPaper.logger.debug "Received request from #{remote_ip}:#{remote_port}"
      services[socket.local_address.ip_port]
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
litmus_paper-1.6.2 lib/litmus_paper/multi_port_agent_server.rb