Class: Bane::Behaviors::Servers::TimeoutInListenQueue

Inherits:
Object
  • Object
show all
Defined in:
lib/bane/behaviors/servers/timeout_in_listen_queue.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(port, host = Servers::LOCALHOST) ⇒ TimeoutInListenQueue

Returns a new instance of TimeoutInListenQueue.



11
12
13
14
15
# File 'lib/bane/behaviors/servers/timeout_in_listen_queue.rb', line 11

def initialize(port, host = Servers::LOCALHOST)
  @port = port
  @host = host
  self.stdlog= $stderr
end

Class Method Details

.make(port, host) ⇒ Object



38
39
40
# File 'lib/bane/behaviors/servers/timeout_in_listen_queue.rb', line 38

def self.make(port, host)
  new(port, host)
end

Instance Method Details

#joinObject



25
26
27
# File 'lib/bane/behaviors/servers/timeout_in_listen_queue.rb', line 25

def join
  sleep
end

#startObject



17
18
19
20
21
22
23
# File 'lib/bane/behaviors/servers/timeout_in_listen_queue.rb', line 17

def start
  @server = Socket.new(:INET, :STREAM)
  address = Socket.sockaddr_in(port, host)
  @server.bind(address) # Note that we never call listen

  log 'started'
end

#stdlog=(logger) ⇒ Object



34
35
36
# File 'lib/bane/behaviors/servers/timeout_in_listen_queue.rb', line 34

def stdlog=(logger)
  @logger = logger
end

#stopObject



29
30
31
32
# File 'lib/bane/behaviors/servers/timeout_in_listen_queue.rb', line 29

def stop
  @server.close
  log 'stopped'
end