lib/tork/server.rb in tork-17.1.0 vs lib/tork/server.rb in tork-18.0.0
- old
+ new
@@ -1,10 +1,14 @@
require 'tork/client'
module Tork
-module Server
+class Server
+ def initialize
+ trap(:SIGTERM){ quit }
+ end
+
def quit
Thread.exit # kill Client::Receiver in loop()
end
def loop
@@ -20,13 +24,11 @@
warn "#{self}: invalid command: #{method}"
end
end.join
rescue Interrupt
# forced quit
- end
-
- def self.extended server
- trap(:SIGTERM){ server.quit }
+ ensure
+ Process.waitall
end
end
end