lib/tork/server.rb in tork-19.1.0 vs lib/tork/server.rb in tork-19.2.0
- old
+ new
@@ -16,16 +16,16 @@
@stdout = STDOUT.dup
STDOUT.reopen STDERR
@clients = Set.new.add(STDIN)
@servers = Set.new
+ @address = Server.address
end
def loop
- server = UNIXServer.open(Server.address)
- @servers.add server
catch :quit do
+ @servers.add server = UNIXServer.open(@address)
while @clients.include? STDIN
IO.select((@servers + @clients).to_a).first.each do |stream|
@client = stream
if stream == server
@@ -40,10 +40,10 @@
end
end
end
ensure
# UNIX domain socket files are not deleted automatically upon closing
- File.delete server.path
+ File.delete @address if File.socket? @address
end
def quit
throw :quit
end