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.



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

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

Class Method Details

.make(port, host) ⇒ Object



36
37
38
# File 'lib/bane/behaviors/servers/timeout_in_listen_queue.rb', line 36

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

Instance Method Details

#joinObject



23
24
25
# File 'lib/bane/behaviors/servers/timeout_in_listen_queue.rb', line 23

def join
  sleep
end

#startObject



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

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



32
33
34
# File 'lib/bane/behaviors/servers/timeout_in_listen_queue.rb', line 32

def stdlog=(logger)
  @logger = logger
end

#stopObject



27
28
29
30
# File 'lib/bane/behaviors/servers/timeout_in_listen_queue.rb', line 27

def stop
  @server.close
  log 'stopped'
end