New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

close hijacked i/o socket after use (fixes #25613) #25615

Merged
merged 1 commit into from Jul 1, 2016
Jump to file or symbol
Failed to load files and symbols.
+15 −0
Diff settings

Always

Just for now

@@ -50,6 +50,7 @@ def hijack_rack_socket
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 @@ def on_error(message)
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',