Class: TP2::Server

Inherits:
Object
  • Object
show all
Defined in:
lib/tp2/server.rb

Constant Summary collapse

PENDING_REQUESTS_GRACE_PERIOD =
0.1
PENDING_REQUESTS_TIMEOUT_PERIOD =
5

Instance Method Summary collapse

Constructor Details

#initialize(machine, hostname, port, &app) ⇒ Server

Returns a new instance of Server.



11
12
13
14
15
16
# File 'lib/tp2/server.rb', line 11

def initialize(machine, hostname, port, &app)
  @machine = machine
  @hostname = hostname
  @port = port
  @app = app
end

Instance Method Details

#runObject



18
19
20
21
22
23
# File 'lib/tp2/server.rb', line 18

def run
  setup
  accept_incoming
rescue UM::Terminate
  graceful_shutdown
end