mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
close hijacked i/o socket after use (fixes #25613)
This commit is contained in:
parent
b036b7a810
commit
3120b51de7
2 changed files with 15 additions and 0 deletions
|
@ -50,6 +50,7 @@ module ActionCable
|
|||
def clean_rack_hijack
|
||||
return unless @rack_hijack_io
|
||||
@event_loop.detach(@rack_hijack_io, self)
|
||||
@rack_hijack_io.close
|
||||
@rack_hijack_io = nil
|
||||
end
|
||||
end
|
||||
|
|
|
@ -48,6 +48,20 @@ class ActionCable::Connection::ClientSocketTest < ActionCable::TestCase
|
|||
end
|
||||
end
|
||||
|
||||
test 'closes hijacked i/o socket at shutdown' do
|
||||
skip if ENV['FAYE'].present?
|
||||
|
||||
run_in_eventmachine do
|
||||
connection = open_connection
|
||||
|
||||
client = connection.websocket.send(:websocket)
|
||||
client.instance_variable_get('@stream')
|
||||
.instance_variable_get('@rack_hijack_io')
|
||||
.expects(:close)
|
||||
connection.close
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
def open_connection
|
||||
env = Rack::MockRequest.env_for '/test',
|
||||
|
|
Loading…
Reference in a new issue