mirror of
https://github.com/puma/puma.git
synced 2022-11-09 13:48:40 -05:00
Syncronize all access to @timeouts. Fixes #208
This commit is contained in:
parent
4d3c85876b
commit
b61a372ada
1 changed files with 13 additions and 9 deletions
|
@ -50,7 +50,9 @@ module Puma
|
|||
# list or we'll accidentally close the socket when
|
||||
# it's in use!
|
||||
if c.timeout_at
|
||||
@timeouts.delete c
|
||||
@mutex.synchronize do
|
||||
@timeouts.delete c
|
||||
end
|
||||
end
|
||||
|
||||
begin
|
||||
|
@ -78,17 +80,19 @@ module Puma
|
|||
end
|
||||
|
||||
unless @timeouts.empty?
|
||||
now = Time.now
|
||||
@mutex.synchronize do
|
||||
now = Time.now
|
||||
|
||||
while @timeouts.first.timeout_at < now
|
||||
c = @timeouts.shift
|
||||
sockets.delete c
|
||||
c.close
|
||||
while @timeouts.first.timeout_at < now
|
||||
c = @timeouts.shift
|
||||
sockets.delete c
|
||||
c.close
|
||||
|
||||
break if @timeouts.empty?
|
||||
break if @timeouts.empty?
|
||||
end
|
||||
|
||||
calculate_sleep
|
||||
end
|
||||
|
||||
calculate_sleep
|
||||
end
|
||||
end
|
||||
ensure
|
||||
|
|
Loading…
Reference in a new issue